home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / mail / elm / elm2.4.p23c.Z / elm2.4.p23c
Encoding:
Text File  |  1993-09-26  |  74.1 KB  |  2,641 lines

  1. Subject: elm 2.4 Patch #23c
  2. Summary: This is an official patch for elm 2.4 system.  Please apply it.
  3. Priority: HIGH
  4.  
  5. THIS IS PART 3 OF A 5 PART PATCH
  6.  
  7. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your elm source
  8.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  9.     If you don't have the patch program, apply the following by hand,
  10.     or get patch (version 2.0, latest patchlevel).
  11.  
  12.     After patching:
  13.         Apply patches 23d, 23e next
  14.  
  15.     If patch indicates that patchlevel is the wrong version, you may need
  16.     to apply one or more previous patches, or the patch may already
  17.     have been applied.  See the patchlevel.h file to find out what has or
  18.     has not been applied.  In any event, don't continue with the patch.
  19.  
  20.     If you are missing previous patches they can be obtained from our:
  21.     archive server.
  22.  
  23.     Syd Weinstein
  24.     elm@DSI.COM
  25.  
  26.     The patches are available from the dsinc archive server
  27.     Send the following message to archive-server@DSI.COM for
  28.     a list of available patches:
  29.  
  30.     Subject: patch list
  31.     send index elm
  32.  
  33. Index: lib/ndbz.c
  34. Prereq: 5.6
  35. *** ../elm2.4/lib/ndbz.c    Sun Apr 11 23:22:31 1993
  36. --- lib/ndbz.c    Sun Aug 22 22:46:55 1993
  37. ***************
  38. *** 1,7 ****
  39. ! static char rcsid[] = "@(#)$Id: ndbz.c,v 5.6 1993/02/08 00:18:11 syd Exp $";
  40.   
  41.   /*******************************************************************************
  42. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  43.    *
  44.    *            Copyright (c) 1988-1992 USENET Community Trust
  45.    *            Copyright (c) 1986,1987 Dave Taylor
  46. --- 1,7 ----
  47. ! static char rcsid[] = "@(#)$Id: ndbz.c,v 5.11 1993/08/23 02:46:51 syd Exp $";
  48.   
  49.   /*******************************************************************************
  50. !  *  The Elm Mail System  -  $Revision: 5.11 $   $State: Exp $
  51.    *
  52.    *            Copyright (c) 1988-1992 USENET Community Trust
  53.    *            Copyright (c) 1986,1987 Dave Taylor
  54. ***************
  55. *** 13,18 ****
  56. --- 13,47 ----
  57.    *
  58.    *******************************************************************************
  59.    * $Log: ndbz.c,v $
  60. +  * Revision 5.11  1993/08/23  02:46:51  syd
  61. +  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
  62. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  63. +  *
  64. +  * Revision 5.10  1993/08/03  19:28:39  syd
  65. +  * Elm tries to replace the system toupper() and tolower() on current
  66. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  67. +  * collide during linking with routines in isctype.o.  This patch adds
  68. +  * a Configure test to determine whether replacements are really needed
  69. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  70. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  71. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  72. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  73. +  * were dropped.
  74. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  75. +  *
  76. +  * Revision 5.9  1993/08/03  19:22:01  syd
  77. +  * Add proper casts to free() calls to suppress warnings.
  78. +  * Properly cast return types.
  79. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  80. +  *
  81. +  * Revision 5.8  1993/07/20  02:59:53  syd
  82. +  * Support aliases both on 64 bit and 32 bit machines at the same time.
  83. +  * From: Dan Mosedale <mosedale@genome.stanford.edu>
  84. +  *
  85. +  * Revision 5.7  1993/06/09  23:41:34  syd
  86. +  * Add frees of db structure on failed dbz_open
  87. +  * From: Syd
  88. +  *
  89.    * Revision 5.6  1993/02/08  00:18:11  syd
  90.    * fix taghere to be || instead of | and paren to make
  91.    * it catch duplicates again, as per testing.
  92. ***************
  93. *** 74,80 ****
  94.   */
  95.   
  96.   #include "headers.h"
  97. - #include <ctype.h>
  98.   #include <errno.h>
  99.   #ifndef ANSI_C
  100.   extern int errno;
  101. --- 103,108 ----
  102. ***************
  103. *** 194,200 ****
  104.   #endif
  105.   
  106.   static int getconf();
  107. ! static long getno();
  108.   static int putconf();
  109.   static void mybytemap();
  110.   static of_t bytemap();
  111. --- 222,228 ----
  112.   #endif
  113.   
  114.   static int getconf();
  115. ! static int32 getno();
  116.   static int putconf();
  117.   static void mybytemap();
  118.   static of_t bytemap();
  119. ***************
  120. *** 246,252 ****
  121.   #define    MAPOUT(o)    ((db->dbz_bytesame) ? (o) : bytemap((o), db->dbz_mybmap, db->dbz_conf.bytemap))
  122.   
  123.   /* externals used */
  124. ! #ifndef __STDC__ /* avoid problemswith systems that declare atol as a macro */
  125.   extern long atol();
  126.   #endif
  127.   
  128. --- 274,280 ----
  129.   #define    MAPOUT(o)    ((db->dbz_bytesame) ? (o) : bytemap((o), db->dbz_mybmap, db->dbz_conf.bytemap))
  130.   
  131.   /* externals used */
  132. ! #if !ANSI_C  /* avoid problems with systems that declare atol as a macro */
  133.   extern long atol();
  134.   #endif
  135.   
  136. ***************
  137. *** 282,293 ****
  138.   
  139.       if (size != 0 && size < 2) {
  140.           dprint(5, (debugfile, "dbz_fresh: preposterous size (%ld)\n", size));
  141. !         return(NULL);
  142.       }
  143.   
  144.       /* get default configuration */
  145.       if (getconf((FILE *)NULL, (FILE *)NULL, &c) < 0)
  146. !         return(NULL);    /* "can't happen" */
  147.   
  148.       /* and mess with it as specified */
  149.       if (size != 0)
  150. --- 310,321 ----
  151.   
  152.       if (size != 0 && size < 2) {
  153.           dprint(5, (debugfile, "dbz_fresh: preposterous size (%ld)\n", size));
  154. !         return (DBZ *)NULL;
  155.       }
  156.   
  157.       /* get default configuration */
  158.       if (getconf((FILE *)NULL, (FILE *)NULL, &c) < 0)
  159. !         return (DBZ *)NULL; /* "can't happen" */
  160.   
  161.       /* and mess with it as specified */
  162.       if (size != 0)
  163. ***************
  164. *** 316,346 ****
  165.       /* write it out */
  166.       fn = enstring(name, dir);
  167.       if (fn == NULL)
  168. !         return(NULL);
  169.       f = fopen(fn, "w");
  170. !     free(fn);
  171.       if (f == NULL) {
  172.           dprint(5, (debugfile, "dbz_fresh: unable to write config\n"));
  173. !         return(NULL);
  174.       }
  175.       if (putconf(f, &c) < 0) {
  176.           (void) fclose(f);
  177. !         return(NULL);
  178.       }
  179.       if (fclose(f) == EOF) {
  180.           dprint(5, (debugfile, "dbz_fresh: fclose failure\n"));
  181. !         return(NULL);
  182.       }
  183.   
  184.       /* create/truncate .pag */
  185.       fn = enstring(name, pag);
  186.       if (fn == NULL)
  187. !         return(NULL);
  188.       f = fopen(fn, "w");
  189. !     free(fn);
  190.       if (f == NULL) {
  191.           dprint(5, (debugfile, "dbz_fresh: unable to create/truncate .pag file\n"));
  192. !         return(NULL);
  193.       } else
  194.           (void) fclose(f);
  195.   
  196. --- 344,374 ----
  197.       /* write it out */
  198.       fn = enstring(name, dir);
  199.       if (fn == NULL)
  200. !         return (DBZ *)NULL;
  201.       f = fopen(fn, "w");
  202. !     free((malloc_t)fn);
  203.       if (f == NULL) {
  204.           dprint(5, (debugfile, "dbz_fresh: unable to write config\n"));
  205. !         return (DBZ *)NULL;
  206.       }
  207.       if (putconf(f, &c) < 0) {
  208.           (void) fclose(f);
  209. !         return (DBZ *)NULL;
  210.       }
  211.       if (fclose(f) == EOF) {
  212.           dprint(5, (debugfile, "dbz_fresh: fclose failure\n"));
  213. !         return (DBZ *)NULL;
  214.       }
  215.   
  216.       /* create/truncate .pag */
  217.       fn = enstring(name, pag);
  218.       if (fn == NULL)
  219. !         return (DBZ *)NULL;
  220.       f = fopen(fn, "w");
  221. !     free((malloc_t)fn);
  222.       if (f == NULL) {
  223.           dprint(5, (debugfile, "dbz_fresh: unable to create/truncate .pag file\n"));
  224. !         return (DBZ *)NULL;
  225.       } else
  226.           (void) fclose(f);
  227.   
  228. ***************
  229. *** 426,443 ****
  230.       /* pick up the old configuration */
  231.       fn = enstring(oldname, dir);
  232.       if (fn == NULL)
  233. !         return(NULL);
  234.       f = fopen(fn, "r");
  235. !     free(fn);
  236.       if (f == NULL) {
  237.           dprint(5, (debugfile, "dbz_again: cannot open old .dir file\n"));
  238. !         return(NULL);
  239.       }
  240.       i = getconf(f, (FILE *)NULL, &c);
  241.       (void) fclose(f);
  242.       if (i < 0) {
  243.           dprint(5, (debugfile, "dbz_again: getconf failed\n"));
  244. !         return(NULL);
  245.       }
  246.   
  247.       /* tinker with it */
  248. --- 454,471 ----
  249.       /* pick up the old configuration */
  250.       fn = enstring(oldname, dir);
  251.       if (fn == NULL)
  252. !         return (DBZ *)NULL;
  253.       f = fopen(fn, "r");
  254. !     free((malloc_t)fn);
  255.       if (f == NULL) {
  256.           dprint(5, (debugfile, "dbz_again: cannot open old .dir file\n"));
  257. !         return (DBZ *)NULL;
  258.       }
  259.       i = getconf(f, (FILE *)NULL, &c);
  260.       (void) fclose(f);
  261.       if (i < 0) {
  262.           dprint(5, (debugfile, "dbz_again: getconf failed\n"));
  263. !         return (DBZ *)NULL;
  264.       }
  265.   
  266.       /* tinker with it */
  267. ***************
  268. *** 463,491 ****
  269.       /* write it out */
  270.       fn = enstring(name, dir);
  271.       if (fn == NULL)
  272. !         return(NULL);
  273.       f = fopen(fn, "w");
  274. !     free(fn);
  275.       if (f == NULL) {
  276.           dprint(5, (debugfile, "dbz_again: unable to write new .dir\n"));
  277. !         return(NULL);
  278.       }
  279.       i = putconf(f, &c);
  280.       (void) fclose(f);
  281.       if (i < 0) {
  282.           dprint(5, (debugfile, "dbz_again: putconf failed\n"));
  283. !         return(NULL);
  284.       }
  285.   
  286.       /* create/truncate .pag */
  287.       fn = enstring(name, pag);
  288.       if (fn == NULL)
  289. !         return(NULL);
  290.       f = fopen(fn, "w");
  291. !     free(fn);
  292.       if (f == NULL) {
  293.           dprint(5, (debugfile, "dbz_again: unable to create/truncate .pag file\n"));
  294. !         return(NULL);
  295.       } else
  296.           (void) fclose(f);
  297.   
  298. --- 491,519 ----
  299.       /* write it out */
  300.       fn = enstring(name, dir);
  301.       if (fn == NULL)
  302. !         return (DBZ *)NULL;
  303.       f = fopen(fn, "w");
  304. !     free((malloc_t)fn);
  305.       if (f == NULL) {
  306.           dprint(5, (debugfile, "dbz_again: unable to write new .dir\n"));
  307. !         return (DBZ *)NULL;
  308.       }
  309.       i = putconf(f, &c);
  310.       (void) fclose(f);
  311.       if (i < 0) {
  312.           dprint(5, (debugfile, "dbz_again: putconf failed\n"));
  313. !         return (DBZ *)NULL;
  314.       }
  315.   
  316.       /* create/truncate .pag */
  317.       fn = enstring(name, pag);
  318.       if (fn == NULL)
  319. !         return (DBZ *)NULL;
  320.       f = fopen(fn, "w");
  321. !     free((malloc_t)fn);
  322.       if (f == NULL) {
  323.           dprint(5, (debugfile, "dbz_again: unable to create/truncate .pag file\n"));
  324. !         return (DBZ *)NULL;
  325.       } else
  326.           (void) fclose(f);
  327.   
  328. ***************
  329. *** 512,540 ****
  330.   
  331.       if ((db = (DBZ *) calloc(sizeof(DBZ), 1)) == NULL) {
  332.           dprint(5, (debugfile, "dbz_open: no room for DBZ structure\n"));
  333. !         return(NULL);
  334.       }
  335.       /* open the .dir file */
  336.       dirfname = enstring(name, dir);
  337. !     if (dirfname == NULL)
  338. !         return(NULL);
  339.   
  340.       if (mode == O_RDONLY) {
  341.           db->dbz_dirf = fopen(dirfname, "r");
  342.           db->dbz_dirronly = 1;
  343.       } else
  344.           db->dbz_dirf = fopen(dirfname, "r+");
  345. !     free(dirfname);
  346.       if (db->dbz_dirf == NULL) {
  347.           dprint(5, (debugfile, "dbz_open: can't open .dir file\n"));
  348. !         return(NULL);
  349.       }
  350.   
  351.       /* open the .pag file */
  352.       pagfname = enstring(name, pag);
  353.       if (pagfname == NULL) {
  354.           (void) fclose(db->dbz_dirf);
  355. !         return(NULL);
  356.       }
  357.       if (mode == O_RDONLY) {
  358.           db->dbz_pagf = fopen(pagfname, "rb");
  359. --- 540,573 ----
  360.   
  361.       if ((db = (DBZ *) calloc(sizeof(DBZ), 1)) == NULL) {
  362.           dprint(5, (debugfile, "dbz_open: no room for DBZ structure\n"));
  363. !         return (DBZ *)NULL;
  364.       }
  365.       /* open the .dir file */
  366.       dirfname = enstring(name, dir);
  367. !     if (dirfname == NULL) {
  368. !         free((malloc_t)db);
  369. !         return (DBZ *)NULL;
  370. !     }
  371.   
  372.       if (mode == O_RDONLY) {
  373.           db->dbz_dirf = fopen(dirfname, "r");
  374.           db->dbz_dirronly = 1;
  375.       } else
  376.           db->dbz_dirf = fopen(dirfname, "r+");
  377. !     free((malloc_t)dirfname);
  378.       if (db->dbz_dirf == NULL) {
  379.           dprint(5, (debugfile, "dbz_open: can't open .dir file\n"));
  380. !         free((malloc_t)db);
  381. !         return (DBZ *)NULL;
  382.       }
  383.   
  384.       /* open the .pag file */
  385.       pagfname = enstring(name, pag);
  386.       if (pagfname == NULL) {
  387.           (void) fclose(db->dbz_dirf);
  388. !         free((malloc_t)db);
  389. !         return (DBZ *)NULL;
  390.       }
  391.       if (mode == O_RDONLY) {
  392.           db->dbz_pagf = fopen(pagfname, "rb");
  393. ***************
  394. *** 545,552 ****
  395.       if (db->dbz_pagf == NULL) {
  396.           dprint(5, (debugfile, "dbz_open: .pag open failed\n"));
  397.           (void) fclose(db->dbz_dirf);
  398. !         free(pagfname);
  399. !         return(NULL);
  400.       }
  401.   #ifdef NOBUFFER
  402.       /*
  403. --- 578,586 ----
  404.       if (db->dbz_pagf == NULL) {
  405.           dprint(5, (debugfile, "dbz_open: .pag open failed\n"));
  406.           (void) fclose(db->dbz_dirf);
  407. !         free((malloc_t)pagfname);
  408. !         free((malloc_t)db);
  409. !         return (DBZ *)NULL;
  410.       }
  411.   #ifdef NOBUFFER
  412.       /*
  413. ***************
  414. *** 572,579 ****
  415.           if (db->dbz_basefname == NULL) {
  416.               (void) fclose(db->dbz_pagf);
  417.               (void) fclose(db->dbz_dirf);
  418. !             free(pagfname);
  419. !             return(NULL);
  420.           }
  421.       } else
  422.           db->dbz_basefname = NULL;
  423. --- 606,614 ----
  424.           if (db->dbz_basefname == NULL) {
  425.               (void) fclose(db->dbz_pagf);
  426.               (void) fclose(db->dbz_dirf);
  427. !             free((malloc_t)pagfname);
  428. !             free((malloc_t)db);
  429. !             return (DBZ *)NULL;
  430.           }
  431.       } else
  432.           db->dbz_basefname = NULL;
  433. ***************
  434. *** 589,597 ****
  435.           (void) fclose(db->dbz_pagf);
  436.           (void) fclose(db->dbz_basef);
  437.           (void) fclose(db->dbz_dirf);
  438. !         free(pagfname);
  439.           errno = EDOM;    /* kind of a kludge, but very portable */
  440. !         return(NULL);
  441.       }
  442.       db->dbz_tagbits = db->dbz_conf.tagmask << db->dbz_conf.tagshift;
  443.       db->dbz_taghere = db->dbz_conf.tagenb << db->dbz_conf.tagshift;
  444. --- 624,633 ----
  445.           (void) fclose(db->dbz_pagf);
  446.           (void) fclose(db->dbz_basef);
  447.           (void) fclose(db->dbz_dirf);
  448. !         free((malloc_t)pagfname);
  449. !         free((malloc_t)db);
  450.           errno = EDOM;    /* kind of a kludge, but very portable */
  451. !         return (DBZ *)NULL;
  452.       }
  453.       db->dbz_tagbits = db->dbz_conf.tagmask << db->dbz_conf.tagshift;
  454.       db->dbz_taghere = db->dbz_conf.tagenb << db->dbz_conf.tagshift;
  455. ***************
  456. *** 613,619 ****
  457.           db->dbz_bufpagf = NULL;
  458.           db->dbz_corepag = NULL;
  459.       }
  460. !     free(pagfname);
  461.   
  462.       /* misc. setup */
  463.       crcinit();
  464. --- 649,655 ----
  465.           db->dbz_bufpagf = NULL;
  466.           db->dbz_corepag = NULL;
  467.       }
  468. !     free((malloc_t)pagfname);
  469.   
  470.       /* misc. setup */
  471.       crcinit();
  472. ***************
  473. *** 668,681 ****
  474.           ret = -1;
  475.       }
  476.       if (db->dbz_corepag != NULL)
  477. !         free((char *)db->dbz_corepag);
  478.       db->dbz_corepag = NULL;
  479.       if (fclose(db->dbz_basef) == EOF) {
  480.           dprint(5, (debugfile, "dbz_close: fclose(basef) failed\n"));
  481.           ret = -1;
  482.       }
  483.       if (db->dbz_basefname != NULL)
  484. !         free(db->dbz_basefname);
  485.       db->dbz_basef = NULL;
  486.       db->dbz_pagf = NULL;
  487.       if (fclose(db->dbz_dirf) == EOF) {
  488. --- 704,717 ----
  489.           ret = -1;
  490.       }
  491.       if (db->dbz_corepag != NULL)
  492. !         free((malloc_t)db->dbz_corepag);
  493.       db->dbz_corepag = NULL;
  494.       if (fclose(db->dbz_basef) == EOF) {
  495.           dprint(5, (debugfile, "dbz_close: fclose(basef) failed\n"));
  496.           ret = -1;
  497.       }
  498.       if (db->dbz_basefname != NULL)
  499. !         free((malloc_t)db->dbz_basefname);
  500.       db->dbz_basef = NULL;
  501.       db->dbz_pagf = NULL;
  502.       if (fclose(db->dbz_dirf) == EOF) {
  503. ***************
  504. *** 683,689 ****
  505.           ret = -1;
  506.       }
  507.   
  508. !     free((char *) db);
  509.   
  510.       dprint(5, (debugfile, "dbz_close: %s\n", (ret == 0) ? "succeeded" : "failed"));
  511.       return(ret);
  512. --- 719,725 ----
  513.           ret = -1;
  514.       }
  515.   
  516. !     free((malloc_t) db);
  517.   
  518.       dprint(5, (debugfile, "dbz_close: %s\n", (ret == 0) ? "succeeded" : "failed"));
  519.       return(ret);
  520. ***************
  521. *** 829,842 ****
  522.   
  523.       if (db->dbz_basefname == NULL) {
  524.           dprint(5, (debugfile, "latebase: name foulup\n"));
  525. !         return(NULL);
  526.       }
  527.       it = fopen(db->dbz_basefname, "r");
  528.       if (it == NULL) {
  529.           dprint(5, (debugfile, "latebase: still can't open base\n"));
  530.       } else {
  531.           dprint(5, (debugfile, "latebase: late open succeeded\n"));
  532. !         free(db->dbz_basefname);
  533.           db->dbz_basefname = NULL;
  534.   #ifdef _IOFBF
  535.           (void) setvbuf(it, db->dbz_basebuf, _IOFBF, sizeof(db->dbz_basebuf));
  536. --- 865,878 ----
  537.   
  538.       if (db->dbz_basefname == NULL) {
  539.           dprint(5, (debugfile, "latebase: name foulup\n"));
  540. !         return (FILE *)NULL;
  541.       }
  542.       it = fopen(db->dbz_basefname, "r");
  543.       if (it == NULL) {
  544.           dprint(5, (debugfile, "latebase: still can't open base\n"));
  545.       } else {
  546.           dprint(5, (debugfile, "latebase: late open succeeded\n"));
  547. !         free((malloc_t)db->dbz_basefname);
  548.           db->dbz_basefname = NULL;
  549.   #ifdef _IOFBF
  550.           (void) setvbuf(it, db->dbz_basebuf, _IOFBF, sizeof(db->dbz_basebuf));
  551. ***************
  552. *** 988,996 ****
  553.   }
  554.   
  555.   /*
  556. !  - getno - get a long
  557.    */
  558. ! static long
  559.   getno(f, ep)
  560.   FILE *f;
  561.   int *ep;
  562. --- 1024,1032 ----
  563.   }
  564.   
  565.   /*
  566. !  - getno - get an int32
  567.    */
  568. ! static int32
  569.   getno(f, ep)
  570.   FILE *f;
  571.   int *ep;
  572. ***************
  573. *** 1023,1029 ****
  574.           dprint(5, (debugfile, "getno: `%s' non-numeric\n", getbuf));
  575.           *ep = -1;
  576.       }
  577. !     return(atol(getbuf));
  578.   }
  579.   
  580.   /*
  581. --- 1059,1066 ----
  582.           dprint(5, (debugfile, "getno: `%s' non-numeric\n", getbuf));
  583.           *ep = -1;
  584.       }
  585. !     return((int32)atol(getbuf));
  586.   }
  587.   
  588.   /*
  589. ***************
  590. *** 1073,1086 ****
  591.       it = malloc((size_t)db->dbz_conf.tsize * SOF);
  592.       if (it == NULL) {
  593.           dprint(5, (debugfile, "getcore: malloc failed\n"));
  594. !         return(NULL);
  595.       }
  596.   
  597.       nread = fread(it, SOF, (size_t)db->dbz_conf.tsize, db->dbz_bufpagf);
  598.       if (ferror(db->dbz_bufpagf)) {
  599.           dprint(5, (debugfile, "getcore: read failed\n"));
  600. !         free(it);
  601. !         return(NULL);
  602.       }
  603.   
  604.       p = (of_t *)it + nread;
  605. --- 1110,1123 ----
  606.       it = malloc((size_t)db->dbz_conf.tsize * SOF);
  607.       if (it == NULL) {
  608.           dprint(5, (debugfile, "getcore: malloc failed\n"));
  609. !         return (of_t *)NULL;
  610.       }
  611.   
  612.       nread = fread(it, SOF, (size_t)db->dbz_conf.tsize, db->dbz_bufpagf);
  613.       if (ferror(db->dbz_bufpagf)) {
  614.           dprint(5, (debugfile, "getcore: read failed\n"));
  615. !         free((malloc_t)it);
  616. !         return (of_t *)NULL;
  617.       }
  618.   
  619.       p = (of_t *)it + nread;
  620.  
  621. Index: lib/opt_utils.c
  622. Prereq: 5.7
  623. *** ../elm2.4/lib/opt_utils.c    Tue Jan 19 22:02:34 1993
  624. --- lib/opt_utils.c    Tue Aug  3 16:11:44 1993
  625. ***************
  626. *** 1,8 ****
  627.   
  628. ! static char rcsid[] = "@(#)$Id: opt_utils.c,v 5.7 1993/01/20 03:02:19 syd Exp $";
  629.   
  630.   /*******************************************************************************
  631. !  *  The Elm Mail System  -  $Revision: 5.7 $   $State: Exp $
  632.    *
  633.    *            Copyright (c) 1988-1992 USENET Community Trust
  634.    *            Copyright (c) 1986,1987 Dave Taylor
  635. --- 1,8 ----
  636.   
  637. ! static char rcsid[] = "@(#)$Id: opt_utils.c,v 5.8 1993/08/03 19:28:39 syd Exp $";
  638.   
  639.   /*******************************************************************************
  640. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  641.    *
  642.    *            Copyright (c) 1988-1992 USENET Community Trust
  643.    *            Copyright (c) 1986,1987 Dave Taylor
  644. ***************
  645. *** 14,19 ****
  646. --- 14,31 ----
  647.    *
  648.    *******************************************************************************
  649.    * $Log: opt_utils.c,v $
  650. +  * Revision 5.8  1993/08/03  19:28:39  syd
  651. +  * Elm tries to replace the system toupper() and tolower() on current
  652. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  653. +  * collide during linking with routines in isctype.o.  This patch adds
  654. +  * a Configure test to determine whether replacements are really needed
  655. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  656. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  657. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  658. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  659. +  * were dropped.
  660. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  661. +  *
  662.    * Revision 5.7  1993/01/20  03:02:19  syd
  663.    * Move string declarations to defs.h
  664.    * From: Syd
  665. ***************
  666. *** 57,63 ****
  667.   
  668.   #include "headers.h"
  669.   #include "s_error.h"
  670. - #include <ctype.h>
  671.   
  672.   #ifdef PWDINSYS
  673.   #  include <sys/pwd.h>
  674. --- 69,74 ----
  675. ***************
  676. *** 65,75 ****
  677.   #  include <pwd.h>
  678.   #endif
  679.   
  680. - #ifdef BSD
  681. - #undef tolower
  682. - #undef toupper
  683. - #endif
  684.   #ifndef GETHOSTNAME
  685.   # ifdef DOUNAME
  686.   #  include <sys/utsname.h>
  687. --- 76,81 ----
  688. ***************
  689. *** 217,251 ****
  690.   
  691.   #endif
  692.   
  693. - #if defined(BSD) && !defined(_POSIX_SOURCE)
  694. - /** some supplementary string functions for Berkeley Unix systems **/
  695. - int
  696. - tolower(ch)
  697. - int ch;
  698. - {
  699. -     /** This should be a macro call, but if you use this as a macro
  700. -         calls to 'tolower' where the argument is a function call will
  701. -         cause the function to be called TWICE which is obviously the
  702. -         wrong behaviour.  On the other hand, to just blindly translate
  703. -         assuming the character is always uppercase can cause BIG
  704. -         problems, so...
  705. -     **/
  706. -     return ( isupper(ch) ? ch - 'A' + 'a' : ch );
  707. - }
  708. - int
  709. - toupper(ch)
  710. - int ch;
  711. - {
  712. -     /** see comment for above routine - tolower() **/
  713. -     return ( islower(ch) ? ch - 'a' + 'A' : ch );
  714. - }
  715. - #endif
  716.   
  717.   #ifndef STRTOK
  718.   
  719. --- 223,228 ----
  720.  
  721. Index: lib/parsarpdat.c
  722. Prereq: 5.2
  723. *** ../elm2.4/lib/parsarpdat.c    Sun Apr 11 22:16:33 1993
  724. --- lib/parsarpdat.c    Tue Aug  3 15:28:55 1993
  725. ***************
  726. *** 1,8 ****
  727.   
  728. ! static char rcsid[] = "@(#)$Id: parsarpdat.c,v 5.2 1993/04/12 02:16:32 syd Exp $";
  729.   
  730.   /*******************************************************************************
  731. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  732.    *
  733.    *             Copyright (c) 1993 USENET Community Trust
  734.    *******************************************************************************
  735. --- 1,8 ----
  736.   
  737. ! static char rcsid[] = "@(#)$Id: parsarpdat.c,v 5.3 1993/08/03 19:28:39 syd Exp $";
  738.   
  739.   /*******************************************************************************
  740. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  741.    *
  742.    *             Copyright (c) 1993 USENET Community Trust
  743.    *******************************************************************************
  744. ***************
  745. *** 13,18 ****
  746. --- 13,30 ----
  747.    *
  748.    *******************************************************************************
  749.    * $Log: parsarpdat.c,v $
  750. +  * Revision 5.3  1993/08/03  19:28:39  syd
  751. +  * Elm tries to replace the system toupper() and tolower() on current
  752. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  753. +  * collide during linking with routines in isctype.o.  This patch adds
  754. +  * a Configure test to determine whether replacements are really needed
  755. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  756. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  757. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  758. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  759. +  * were dropped.
  760. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  761. +  *
  762.    * Revision 5.2  1993/04/12  02:16:32  syd
  763.    * Fix year handling bug in date(1) time formats.
  764.    * From: chip@chinacat.unicom.com (Chip Rosenthal)
  765. ***************
  766. *** 25,31 ****
  767.   
  768.   
  769.   #include "headers.h"
  770. - #include <ctype.h>
  771.   
  772.   
  773.   /*
  774. --- 37,42 ----
  775.  
  776. Index: lib/parsarpwho.c
  777. Prereq: 5.3
  778. *** ../elm2.4/lib/parsarpwho.c    Tue Jan 19 00:07:19 1993
  779. --- lib/parsarpwho.c    Mon Jul 19 22:06:41 1993
  780. ***************
  781. *** 1,8 ****
  782.   
  783. ! static char rcsid[] = "@(#)$Id: parsarpwho.c,v 5.3 1993/01/19 05:07:05 syd Exp $";
  784.   
  785.   /*******************************************************************************
  786. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  787.    *
  788.    *            Copyright (c) 1988-1992 USENET Community Trust
  789.    *            Copyright (c) 1986,1987 Dave Taylor
  790. --- 1,8 ----
  791.   
  792. ! static char rcsid[] = "@(#)$Id: parsarpwho.c,v 5.4 1993/07/20 02:06:13 syd Exp $";
  793.   
  794.   /*******************************************************************************
  795. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  796.    *
  797.    *            Copyright (c) 1988-1992 USENET Community Trust
  798.    *            Copyright (c) 1986,1987 Dave Taylor
  799. ***************
  800. *** 14,19 ****
  801. --- 14,23 ----
  802.    *
  803.    *******************************************************************************
  804.    * $Log: parsarpwho.c,v $
  805. +  * Revision 5.4  1993/07/20  02:06:13  syd
  806. +  * Changes for vms problem
  807. +  * From: M.รก Anio
  808. +  *
  809.    * Revision 5.3  1993/01/19  05:07:05  syd
  810.    * Trim erroreous extra log entry
  811.    * From: Syd
  812. ***************
  813. *** 49,54 ****
  814. --- 53,60 ----
  815.           or  From: hplabs!dat (Dave Taylor)
  816.   
  817.           Added: removes quotes if name is quoted (12/12)
  818. +          HOWEVER:  From: "NAME \"VMS USER\"" <USER@VMS>
  819. +                must be handled delicately !
  820.           Added: only copies STRING characters...
  821.           Added: if no comment part, copy address instead! 
  822.           Added: if is_really_a_to, this is really a 'to' line
  823. ***************
  824. *** 119,134 ****
  825.         
  826.       if (strlen(temp) > 0) {        /* mess with buffer... */
  827.   
  828. !       /* remove leading spaces and quotes... */
  829.   
  830. !       while (whitespace(temp[0]) || temp[0] == '"')
  831.           temp = (char *) (temp + 1);        /* increment address! */
  832.   
  833. !       /* remove trailing spaces and quotes... */
  834.   
  835.         i = strlen(temp) - 1;
  836.   
  837. !       while (i >= 0 && (whitespace(temp[i]) || temp[i] == '"'))
  838.          temp[i--] = '\0';
  839.   
  840.         /* if anything is left, let's change 'from' value! */
  841. --- 125,150 ----
  842.         
  843.       if (strlen(temp) > 0) {        /* mess with buffer... */
  844.   
  845. !       /* remove leading spaces and ONE quote... */
  846.   
  847. !       while (whitespace(temp[0]))
  848. !         temp = (char *) (temp + 1);        /* increment address! */
  849. !       if (temp[0] == '"')
  850. !         temp = (char *) (temp + 1);        /* increment address! */
  851. !       while (whitespace(temp[0]))
  852.           temp = (char *) (temp + 1);        /* increment address! */
  853.   
  854. !       /* remove trailing spaces and ONE quote... */
  855.   
  856.         i = strlen(temp) - 1;
  857.   
  858. !       while (i >= 0 && (whitespace(temp[i])))
  859. !        temp[i--] = '\0';
  860. !       /* Can delete ONE trailing quote, NOT THEM ALL!
  861. !          Assuming the incoming quotes were all right.. [mea@utu.fi] */
  862. !       if (i >= 0 && temp[i] == '"')
  863. !        temp[i--] = '\0';
  864. !       while (i >= 0 && (whitespace(temp[i])))
  865.          temp[i--] = '\0';
  866.   
  867.         /* if anything is left, let's change 'from' value! */
  868.  
  869. Index: lib/posixsig.c
  870. Prereq: 5.6
  871. *** ../elm2.4/lib/posixsig.c    Tue Apr 20 21:16:46 1993
  872. --- lib/posixsig.c    Sun Aug 22 22:46:55 1993
  873. ***************
  874. *** 1,8 ****
  875.   
  876. ! static char rcsid[] = "@(#)$Id: posixsig.c,v 5.6 1993/04/21 01:16:45 syd Exp $";
  877.   
  878.   /*******************************************************************************
  879. !  *  The Elm Mail System  -  $Revision: 5.6 $   $State: Exp $
  880.    *
  881.    *            Copyright (c) 1988-1992 USENET Community Trust
  882.    *            Copyright (c) 1986,1987 Dave Taylor
  883. --- 1,8 ----
  884.   
  885. ! static char rcsid[] = "@(#)$Id: posixsig.c,v 5.8 1993/08/23 02:46:51 syd Exp $";
  886.   
  887.   /*******************************************************************************
  888. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  889.    *
  890.    *            Copyright (c) 1988-1992 USENET Community Trust
  891.    *            Copyright (c) 1986,1987 Dave Taylor
  892. ***************
  893. *** 14,19 ****
  894. --- 14,27 ----
  895.    *
  896.    *******************************************************************************
  897.    * $Log: posixsig.c,v $
  898. +  * Revision 5.8  1993/08/23  02:46:51  syd
  899. +  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
  900. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  901. +  *
  902. +  * Revision 5.7  1993/08/03  20:14:49  syd
  903. +  * Fix where some systems name SIG_ERR BADSIG
  904. +  * From: Syd
  905. +  *
  906.    * Revision 5.6  1993/04/21  01:16:45  syd
  907.    * SunOS 4.1.3 uses the BSD convention for signal handling in system
  908.    * calls like read. The system call resumes when the signal handler
  909. ***************
  910. *** 51,61 ****
  911.   #include "headers.h"
  912.   
  913.   #ifdef POSIX_SIGNALS
  914.   /*
  915.    * This routine used to duplicate the old signal() calls
  916.    */
  917.   SIGHAND_TYPE
  918. ! #if (defined(__STDC__) && !defined(apollo))
  919.   (*posix_signal(signo, fun))(int)
  920.       int signo;
  921.       SIGHAND_TYPE (*fun)(int);
  922. --- 59,78 ----
  923.   #include "headers.h"
  924.   
  925.   #ifdef POSIX_SIGNALS
  926. + #ifndef SIG_ERR
  927. + #  ifdef BADSIG
  928. + #    define SIG_ERR BADSIG
  929. + #  else
  930. + #    define SIG_ERR -1
  931. + #  endif /* BADSIG */
  932. + #endif /* SIG_ERRR */
  933.   /*
  934.    * This routine used to duplicate the old signal() calls
  935.    */
  936.   SIGHAND_TYPE
  937. ! #if ANSI_C && !defined(apollo)
  938.   (*posix_signal(signo, fun))(int)
  939.       int signo;
  940.       SIGHAND_TYPE (*fun)(int);
  941.  
  942. Index: lib/qstrings.c
  943. Prereq: 5.1
  944. *** ../elm2.4/lib/qstrings.c    Sat Oct  3 18:42:28 1992
  945. --- lib/qstrings.c    Tue Aug  3 15:28:56 1993
  946. ***************
  947. *** 1,8 ****
  948.   
  949. ! static char rcsid[] = "@(#)$Id: qstrings.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  950.   
  951.   /*******************************************************************************
  952. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  953.    *
  954.    *             Copyright (c) 1988-1992 USENET Community Trust
  955.    *             Copyright (c) 1986,1987 Dave Taylor
  956. --- 1,8 ----
  957.   
  958. ! static char rcsid[] = "@(#)$Id: qstrings.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  959.   
  960.   /*******************************************************************************
  961. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  962.    *
  963.    *             Copyright (c) 1988-1992 USENET Community Trust
  964.    *             Copyright (c) 1986,1987 Dave Taylor
  965. ***************
  966. *** 14,19 ****
  967. --- 14,31 ----
  968.    *
  969.    *******************************************************************************
  970.    * $Log: qstrings.c,v $
  971. +  * Revision 5.2  1993/08/03  19:28:39  syd
  972. +  * Elm tries to replace the system toupper() and tolower() on current
  973. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  974. +  * collide during linking with routines in isctype.o.  This patch adds
  975. +  * a Configure test to determine whether replacements are really needed
  976. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  977. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  978. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  979. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  980. +  * were dropped.
  981. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  982. +  *
  983.    * Revision 5.1  1992/10/03  22:41:36  syd
  984.    * Initial checkin as of 2.4 Release at PL0
  985.    *
  986. ***************
  987. *** 26,37 ****
  988.   **/
  989.   
  990.   #include "headers.h"
  991. - #include <ctype.h>
  992. - #ifdef BSD
  993. - #undef tolower
  994. - #undef toupper
  995. - #endif
  996.   
  997.   char *qstrpbrk(source, keys)
  998.   char *source, *keys;
  999. --- 38,43 ----
  1000.  
  1001. Index: lib/realfrom.c
  1002. Prereq: 5.3
  1003. *** ../elm2.4/lib/realfrom.c    Sat May  8 13:09:56 1993
  1004. --- lib/realfrom.c    Tue Aug  3 15:28:56 1993
  1005. ***************
  1006. *** 1,8 ****
  1007.   
  1008. ! static char rcsid[] = "@(#)$Id: realfrom.c,v 5.3 1993/05/08 17:09:56 syd Exp $";
  1009.   
  1010.   /*******************************************************************************
  1011. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  1012.    *
  1013.    *             Copyright (c) 1993 USENET Community Trust
  1014.    *******************************************************************************
  1015. --- 1,8 ----
  1016.   
  1017. ! static char rcsid[] = "@(#)$Id: realfrom.c,v 5.4 1993/08/03 19:28:39 syd Exp $";
  1018.   
  1019.   /*******************************************************************************
  1020. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  1021.    *
  1022.    *             Copyright (c) 1993 USENET Community Trust
  1023.    *******************************************************************************
  1024. ***************
  1025. *** 13,18 ****
  1026. --- 13,30 ----
  1027.    *
  1028.    *******************************************************************************
  1029.    * $Log: realfrom.c,v $
  1030. +  * Revision 5.4  1993/08/03  19:28:39  syd
  1031. +  * Elm tries to replace the system toupper() and tolower() on current
  1032. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1033. +  * collide during linking with routines in isctype.o.  This patch adds
  1034. +  * a Configure test to determine whether replacements are really needed
  1035. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1036. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1037. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1038. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1039. +  * were dropped.
  1040. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1041. +  *
  1042.    * Revision 5.3  1993/05/08  17:09:56  syd
  1043.    * Fix problem where "<space>From" was recognized as a valid "From_" line.
  1044.    * From: decwrl!decvax!gatech!WLK.COM!chip (Chip Rosenthal)
  1045. ***************
  1046. *** 30,40 ****
  1047.   
  1048.   
  1049.   #include "headers.h"
  1050. - #include <ctype.h>
  1051. - #ifdef BSD
  1052. - #undef tolower
  1053. - #endif
  1054.   
  1055.   
  1056.   extern long make_gmttime();
  1057. --- 42,47 ----
  1058.  
  1059. Index: lib/rfc822tlen.c
  1060. *** /dev/null    Sun Sep 19 14:13:21 1993
  1061. --- lib/rfc822tlen.c    Mon Jul 19 23:15:24 1993
  1062. ***************
  1063. *** 0 ****
  1064. --- 1,155 ----
  1065. + static char rcsid[] = "@(#)$Id: rfc822tlen.c,v 5.2 1993/07/20 03:15:15 syd Exp $";
  1066. + /*******************************************************************************
  1067. +  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  1068. +  *
  1069. +  *            Copyright (c) 1993 USENET Community Trust
  1070. +  *******************************************************************************
  1071. +  * Bug reports, patches, comments, suggestions should be sent to:
  1072. +  *
  1073. +  *    Syd Weinstein, Elm Coordinator
  1074. +  *    elm@DSI.COM            dsinc!elm
  1075. +  *
  1076. +  *******************************************************************************
  1077. +  * $Log: rfc822tlen.c,v $
  1078. +  * Revision 5.2  1993/07/20  03:15:15  syd
  1079. +  * remove extra garbage line
  1080. +  *
  1081. +  * Revision 5.1  1993/06/10  03:02:20  syd
  1082. +  * Initial Checkin
  1083. +  *
  1084. +  *
  1085. +  ******************************************************************************/
  1086. + #include <stdio.h>
  1087. + /*
  1088. +  * rfc822_toklen(str) - Returns length of RFC-822 token that starts at "str".
  1089. +  *
  1090. +  * We understand the following tokens:
  1091. +  *
  1092. +  *    linear-white-space
  1093. +  *    specials
  1094. +  *    "quoted string"
  1095. +  *    [domain.literal]
  1096. +  *    (comment)
  1097. +  *    CTL  (control chars)
  1098. +  *    atom
  1099. +  */
  1100. + #define charlen(s)    ((s)[0] == '\\' && (s)[1] != '\0' ? 2 : 1)
  1101. + #define IS822_SPECIAL(c) ( \
  1102. +     ((c) == '(') || ((c) == ')') || ((c) == '<') || ((c) == '>') \
  1103. +     || ((c) == '@') || ((c) == ',') || ((c) == ';') || ((c) == ':') \
  1104. +     || ((c) == '\\') || ((c) == '"') || ((c) == '.') || ((c) == '[') \
  1105. +     || ((c) == ']') \
  1106. + )
  1107. + /*
  1108. +  * RFC-822 defines SPACE to be just < > and HTAB, but after LWSP folding
  1109. +  * CR and NL should be equivalent.
  1110. +  */
  1111. + #define IS822_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
  1112. + /*
  1113. +  * We've thrown non-ASCII (value > 0177) into this.
  1114. +  */
  1115. + #define IS822_CTL(c)    ((c) <= 037 || (c) >= 0177)
  1116. + #define IS822_ATOMCH(c)    (!IS822_SPECIAL(c) && !IS822_SPACE(c) && !IS822_CTL(c))
  1117. + int rfc822_toklen(str)
  1118. + register char *str;
  1119. + {
  1120. +     char *str0;
  1121. +     int depth;
  1122. +     register int chlen;
  1123. +     str0 = str;
  1124. +     if (*str == '"') {            /* quoted-string */
  1125. +         ++str;
  1126. +         while (*str != '\0' && *str != '"')
  1127. +             str += charlen(str);
  1128. +         if (*str != '\0')
  1129. +             ++str;
  1130. +         return (str-str0);
  1131. +     }
  1132. +     if (*str == '(' ) {            /* comment */
  1133. +         ++str;
  1134. +         depth = 0;
  1135. +         while (*str != '\0' && (*str != ')' || depth > 0)) {
  1136. +             switch (*str) {
  1137. +             case '(':
  1138. +                 ++str;
  1139. +                 ++depth;
  1140. +                 break;
  1141. +             case ')':
  1142. +                 ++str;
  1143. +                 --depth;
  1144. +                 break;
  1145. +             default:
  1146. +                 str += charlen(str);
  1147. +                 break;
  1148. +             }
  1149. +         }
  1150. +         if (*str != '\0')
  1151. +             ++str;
  1152. +         return (str-str0);
  1153. +     }
  1154. +     if (*str == '[') {            /* domain-literal */
  1155. +         ++str;
  1156. +         while (*str != '\0' && *str != ']')
  1157. +             str += charlen(str);
  1158. +         if (*str != '\0')
  1159. +             ++str;
  1160. +         return (str-str0);
  1161. +     }
  1162. +     if (IS822_SPACE(*str)) {        /* linear-white-space */
  1163. +         while (++str, IS822_SPACE(*str))
  1164. +             ;
  1165. +         return (str-str0);
  1166. +     }
  1167. +     if (IS822_SPECIAL(*str) || IS822_CTL(*str))
  1168. +         return charlen(str);        /* specials and CTL */
  1169. +     /*
  1170. +      * Treat as an "atom".
  1171. +      */
  1172. +     while (IS822_ATOMCH(*str))
  1173. +         ++str;
  1174. +     return (str-str0);
  1175. + }
  1176. + #ifdef _TEST
  1177. + main()
  1178. + {
  1179. +     char buf[1024], *bp;
  1180. +     int len;
  1181. +     for (;;) {
  1182. +         fputs("\nstr> ", stdout);
  1183. +         fflush(stdout);
  1184. +         if (gets(buf) == NULL) {
  1185. +             putchar('\n');
  1186. +             break;
  1187. +         }
  1188. +         bp = buf;
  1189. +         while (*bp != '\0') {
  1190. +             len = rfc822_toklen(bp);
  1191. +             printf("len %4d  |%.*s|\n", len, len, bp);
  1192. +             bp += len;
  1193. +         }
  1194. +     }
  1195. +     exit(0);
  1196. + }
  1197. + #endif
  1198.  
  1199. Index: lib/shiftlower.c
  1200. Prereq: 5.1
  1201. *** ../elm2.4/lib/shiftlower.c    Sat Oct  3 18:42:29 1992
  1202. --- lib/shiftlower.c    Tue Aug  3 15:28:57 1993
  1203. ***************
  1204. *** 1,7 ****
  1205. ! static char rcsid[] = "@(#)$Id: shiftlower.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  1206.   
  1207.   /*******************************************************************************
  1208. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  1209.    *
  1210.    *            Copyright (c) 1988-1992 USENET Community Trust
  1211.    *            Copyright (c) 1986,1987 Dave Taylor
  1212. --- 1,7 ----
  1213. ! static char rcsid[] = "@(#)$Id: shiftlower.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  1214.   
  1215.   /*******************************************************************************
  1216. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  1217.    *
  1218.    *            Copyright (c) 1988-1992 USENET Community Trust
  1219.    *            Copyright (c) 1986,1987 Dave Taylor
  1220. ***************
  1221. *** 13,18 ****
  1222. --- 13,30 ----
  1223.    *
  1224.    *******************************************************************************
  1225.    * $Log: shiftlower.c,v $
  1226. +  * Revision 5.2  1993/08/03  19:28:39  syd
  1227. +  * Elm tries to replace the system toupper() and tolower() on current
  1228. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1229. +  * collide during linking with routines in isctype.o.  This patch adds
  1230. +  * a Configure test to determine whether replacements are really needed
  1231. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1232. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1233. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1234. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1235. +  * were dropped.
  1236. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1237. +  *
  1238.    * Revision 5.1  1992/10/03  22:41:36  syd
  1239.    * Initial checkin as of 2.4 Release at PL0
  1240.    *
  1241. ***************
  1242. *** 25,37 ****
  1243.   
  1244.   #include "headers.h"
  1245.   
  1246. - #include <ctype.h>
  1247. - #ifdef BSD
  1248. - #undef tolower
  1249. - #undef toupper
  1250. - #endif
  1251.   char *shift_lower(string)
  1252.   char *string;
  1253.   {
  1254. --- 37,42 ----
  1255. ***************
  1256. *** 42,51 ****
  1257.       register char *bufptr = buffer;
  1258.   
  1259.       for (; *string; string++, bufptr++)
  1260. !       if (isupper(*string))
  1261. !         *bufptr = tolower(*string);
  1262. !       else
  1263. !         *bufptr = *string;
  1264.       
  1265.       *bufptr = 0;
  1266.       
  1267. --- 47,53 ----
  1268.       register char *bufptr = buffer;
  1269.   
  1270.       for (; *string; string++, bufptr++)
  1271. !       *bufptr = tolower(*string);
  1272.       
  1273.       *bufptr = 0;
  1274.       
  1275.  
  1276. Index: lib/strftime.c
  1277. Prereq: 5.4
  1278. *** ../elm2.4/lib/strftime.c    Sat May  8 15:56:51 1993
  1279. --- lib/strftime.c    Sun Aug 22 22:46:56 1993
  1280. ***************
  1281. *** 1,8 ****
  1282.   
  1283. ! static char rcsid[] = "@(#)$Id: strftime.c,v 5.4 1993/05/08 19:56:45 syd Exp $";
  1284.   
  1285.   /*******************************************************************************
  1286. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  1287.    *
  1288.    * Public-domain relatively quick-and-dirty implemenation of
  1289.    * ANSI library routine for System V Unix systems.
  1290. --- 1,8 ----
  1291.   
  1292. ! static char rcsid[] = "@(#)$Id: strftime.c,v 5.8 1993/08/23 02:46:51 syd Exp $";
  1293.   
  1294.   /*******************************************************************************
  1295. !  *  The Elm Mail System  -  $Revision: 5.8 $   $State: Exp $
  1296.    *
  1297.    * Public-domain relatively quick-and-dirty implemenation of
  1298.    * ANSI library routine for System V Unix systems.
  1299. ***************
  1300. *** 19,24 ****
  1301. --- 19,52 ----
  1302.    *
  1303.    *******************************************************************************
  1304.    * $Log: strftime.c,v $
  1305. +  * Revision 5.8  1993/08/23  02:46:51  syd
  1306. +  * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
  1307. +  * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
  1308. +  *
  1309. +  * Revision 5.7  1993/08/03  19:28:39  syd
  1310. +  * Elm tries to replace the system toupper() and tolower() on current
  1311. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1312. +  * collide during linking with routines in isctype.o.  This patch adds
  1313. +  * a Configure test to determine whether replacements are really needed
  1314. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1315. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1316. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1317. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1318. +  * were dropped.
  1319. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1320. +  *
  1321. +  * Revision 5.6  1993/08/03  19:20:31  syd
  1322. +  * Implement new timezone handling.  New file lib/get_tz.c with new timezone
  1323. +  * routines.  Added new TZMINS_USE_xxxxxx and TZNAME_USE_xxxxxx configuration
  1324. +  * definitions.  Obsoleted TZNAME, ALTCHECK, and TZ_MINUTESWEST configuration
  1325. +  * definitions.  Updated Configure.  Modified lib/getarpdate.c and
  1326. +  * lib/strftime.c to use new timezone routines.
  1327. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1328. +  *
  1329. +  * Revision 5.5  1993/06/10  03:17:45  syd
  1330. +  * Change from TZNAME_MISSING to TZNAME
  1331. +  * From: Syd via request from Dan Blanchard
  1332. +  *
  1333.    * Revision 5.4  1993/05/08  19:56:45  syd
  1334.    * update to newer version
  1335.    * From: Syd
  1336. ***************
  1337. *** 79,103 ****
  1338.   #ifdef I_SYSTIME
  1339.   #  include <sys/time.h>
  1340.   #endif
  1341. - #ifdef BSD
  1342. - #  include <sys/timeb.h>
  1343. - #endif
  1344.   
  1345. ! #include <ctype.h>
  1346.   
  1347. ! #ifndef __STDC__
  1348. ! #define const    /**/
  1349.   
  1350.   #ifndef BSD
  1351. ! extern void tzset();
  1352. ! #endif
  1353. ! static int weeknumber();
  1354. ! #else /* __STDC__ */
  1355. ! #ifndef BSD
  1356. ! extern void tzset(void);
  1357.   #endif
  1358. ! static int weeknumber(const struct tm *timeptr, int firstweekday);
  1359. ! #endif
  1360.   
  1361.   /* defaults: season to taste */
  1362.   #define SYSV_EXT    1    /* stuff in System V ascftime routine */
  1363. --- 107,126 ----
  1364.   #ifdef I_SYSTIME
  1365.   #  include <sys/time.h>
  1366.   #endif
  1367.   
  1368. ! #if ANSI_C
  1369. ! # define P_(x) x
  1370. ! #else
  1371. ! # define P_(x) /**/
  1372. ! # define const    /**/
  1373. ! #endif
  1374.   
  1375. ! extern char *get_tz_name();
  1376.   
  1377.   #ifndef BSD
  1378. ! extern void tzset P_((void));
  1379.   #endif
  1380. ! static int weeknumber P_((const struct tm *timeptr, int firstweekday));
  1381.   
  1382.   /* defaults: season to taste */
  1383.   #define SYSV_EXT    1    /* stuff in System V ascftime routine */
  1384. ***************
  1385. *** 133,146 ****
  1386.   
  1387.   #define range(low, item, hi)    maximum(low, minimum(item, hi))
  1388.   
  1389. - #ifndef BSD
  1390. - extern char *tzname[2];
  1391. - extern int daylight;
  1392. - #endif
  1393.   /* minimum --- return minimum of two numbers */
  1394.   
  1395. ! #ifndef __STDC__
  1396.   static inline int
  1397.   minimum(a, b)
  1398.   int a, b;
  1399. --- 156,164 ----
  1400.   
  1401.   #define range(low, item, hi)    maximum(low, minimum(item, hi))
  1402.   
  1403.   /* minimum --- return minimum of two numbers */
  1404.   
  1405. ! #if !ANSI_C
  1406.   static inline int
  1407.   minimum(a, b)
  1408.   int a, b;
  1409. ***************
  1410. *** 154,160 ****
  1411.   
  1412.   /* maximum --- return maximum of two numbers */
  1413.   
  1414. ! #ifndef __STDC__
  1415.   static inline int
  1416.   maximum(a, b)
  1417.   int a, b;
  1418. --- 172,178 ----
  1419.   
  1420.   /* maximum --- return maximum of two numbers */
  1421.   
  1422. ! #if !ANSI_C
  1423.   static inline int
  1424.   maximum(a, b)
  1425.   int a, b;
  1426. ***************
  1427. *** 168,174 ****
  1428.   
  1429.   /* strftime --- produce formatted time */
  1430.   
  1431. ! #ifndef __STDC__
  1432.   size_t
  1433.   strftime(s, maxsize, format, timeptr)
  1434.   char *s;
  1435. --- 186,192 ----
  1436.   
  1437.   /* strftime --- produce formatted time */
  1438.   
  1439. ! #if !ANSI_C
  1440.   size_t
  1441.   strftime(s, maxsize, format, timeptr)
  1442.   char *s;
  1443. ***************
  1444. *** 394,411 ****
  1445.               break;
  1446.   
  1447.           case 'Z':    /* time zone name or abbrevation */
  1448. !             i = 0;
  1449. !             if (
  1450. ! #ifndef TZNAME_MISSING
  1451. !                 daylight &&
  1452. ! #endif
  1453. !                 timeptr->tm_isdst)
  1454. !                 i = 1;
  1455. ! #ifdef TZNAME_MISSING
  1456. !             strcpy(tbuf, timeptr->tm_zone);
  1457. ! #else
  1458. !             strcpy(tbuf, tzname[i]);
  1459. ! #endif
  1460.               break;
  1461.   
  1462.   #ifdef SYSV_EXT
  1463. --- 412,418 ----
  1464.               break;
  1465.   
  1466.           case 'Z':    /* time zone name or abbrevation */
  1467. !             strcpy(tbuf, get_tz_name(timeptr));
  1468.               break;
  1469.   
  1470.   #ifdef SYSV_EXT
  1471. ***************
  1472. *** 528,534 ****
  1473.   #ifdef POSIX2_DATE
  1474.   /* iso8601wknum --- compute week number according to ISO 8601 */
  1475.   
  1476. ! #ifndef __STDC__
  1477.   static int
  1478.   iso8601wknum(timeptr)
  1479.   const struct tm *timeptr;
  1480. --- 535,541 ----
  1481.   #ifdef POSIX2_DATE
  1482.   /* iso8601wknum --- compute week number according to ISO 8601 */
  1483.   
  1484. ! #if !ANSI_C
  1485.   static int
  1486.   iso8601wknum(timeptr)
  1487.   const struct tm *timeptr;
  1488. ***************
  1489. *** 590,596 ****
  1490.   
  1491.   /* With thanks and tip of the hatlo to ado@elsie.nci.nih.gov */
  1492.   
  1493. ! #ifndef __STDC__
  1494.   static int
  1495.   weeknumber(timeptr, firstweekday)
  1496.   const struct tm *timeptr;
  1497. --- 597,603 ----
  1498.   
  1499.   /* With thanks and tip of the hatlo to ado@elsie.nci.nih.gov */
  1500.   
  1501. ! #if !ANSI_C
  1502.   static int
  1503.   weeknumber(timeptr, firstweekday)
  1504.   const struct tm *timeptr;
  1505.  
  1506. Index: lib/strincmp.c
  1507. Prereq: 5.1
  1508. *** ../elm2.4/lib/strincmp.c    Sat Oct  3 18:42:29 1992
  1509. --- lib/strincmp.c    Tue Aug  3 15:28:58 1993
  1510. ***************
  1511. *** 1,8 ****
  1512.   
  1513. ! static char rcsid[] = "@(#)$Id: strincmp.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  1514.   
  1515.   /*******************************************************************************
  1516. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  1517.    *
  1518.    *            Copyright (c) 1988-1992 USENET Community Trust
  1519.    *            Copyright (c) 1986,1987 Dave Taylor
  1520. --- 1,8 ----
  1521.   
  1522. ! static char rcsid[] = "@(#)$Id: strincmp.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  1523.   
  1524.   /*******************************************************************************
  1525. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  1526.    *
  1527.    *            Copyright (c) 1988-1992 USENET Community Trust
  1528.    *            Copyright (c) 1986,1987 Dave Taylor
  1529. ***************
  1530. *** 14,19 ****
  1531. --- 14,31 ----
  1532.    *
  1533.    *******************************************************************************
  1534.    * $Log: strincmp.c,v $
  1535. +  * Revision 5.2  1993/08/03  19:28:39  syd
  1536. +  * Elm tries to replace the system toupper() and tolower() on current
  1537. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  1538. +  * collide during linking with routines in isctype.o.  This patch adds
  1539. +  * a Configure test to determine whether replacements are really needed
  1540. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  1541. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  1542. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  1543. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  1544. +  * were dropped.
  1545. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1546. +  *
  1547.    * Revision 5.1  1992/10/03  22:41:36  syd
  1548.    * Initial checkin as of 2.4 Release at PL0
  1549.    *
  1550. ***************
  1551. *** 24,35 ****
  1552.   **/
  1553.   
  1554.   #include "headers.h"
  1555. - #include <ctype.h>
  1556. - #ifdef BSD
  1557. - #undef tolower
  1558. - #undef toupper
  1559. - #endif
  1560.   
  1561.   int
  1562.   strincmp(s1,s2,n)
  1563. --- 36,41 ----
  1564. ***************
  1565. *** 39,46 ****
  1566.       /* case insensitive comparison */
  1567.       register int d;
  1568.       while (--n >= 0) {
  1569. !       d = ( isupper(*s1) ? tolower(*s1) : *s1 )
  1570. !           - ( isupper(*s2) ? tolower(*s2) : *s2 ) ;
  1571.         if ( d != 0 || *s1 == '\0' || *s2 == '\0' )
  1572.           return d;
  1573.         ++s1;
  1574. --- 45,51 ----
  1575.       /* case insensitive comparison */
  1576.       register int d;
  1577.       while (--n >= 0) {
  1578. !       d = (tolower(*s1) - tolower(*s2));
  1579.         if ( d != 0 || *s1 == '\0' || *s2 == '\0' )
  1580.           return d;
  1581.         ++s1;
  1582.  
  1583. Index: lib/striparens.c
  1584. Prereq: 5.1
  1585. *** ../elm2.4/lib/striparens.c    Sat Oct  3 18:42:30 1992
  1586. --- lib/striparens.c    Wed Jun  9 23:09:06 1993
  1587. ***************
  1588. *** 1,7 ****
  1589. ! static char rcsid[] = "@(#)$Id: striparens.c,v 5.1 1992/10/03 22:41:36 syd Exp $";
  1590.   
  1591.   /*******************************************************************************
  1592. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  1593.    *
  1594.    *            Copyright (c) 1988-1992 USENET Community Trust
  1595.    *            Copyright (c) 1986,1987 Dave Taylor
  1596. --- 1,7 ----
  1597. ! static char rcsid[] = "@(#)$Id: striparens.c,v 5.2 1993/06/10 03:09:06 syd Exp $";
  1598.   
  1599.   /*******************************************************************************
  1600. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  1601.    *
  1602.    *            Copyright (c) 1988-1992 USENET Community Trust
  1603.    *            Copyright (c) 1986,1987 Dave Taylor
  1604. ***************
  1605. *** 13,134 ****
  1606.    *
  1607.    *******************************************************************************
  1608.    * $Log: striparens.c,v $
  1609.    * Revision 5.1  1992/10/03  22:41:36  syd
  1610.    * Initial checkin as of 2.4 Release at PL0
  1611.    *
  1612.    *
  1613.    ******************************************************************************/
  1614.   
  1615. ! /** 
  1616. ! **/
  1617.   
  1618.   #include "headers.h"
  1619.   
  1620.   
  1621. ! char *strip_parens(string)
  1622. ! char *string;
  1623.   {
  1624. !     /**
  1625. !         Remove parenthesized information from a string.  More specifically,
  1626. !         comments as defined in RFC822 are removed.  This procedure is
  1627. !         non-destructive - a pointer to static data is returned.
  1628. !     **/
  1629. !     static char  buffer[VERY_LONG_STRING];
  1630. !     register char *bufp;
  1631. !     register int depth, l;
  1632. !     bufp = buffer;
  1633. !     depth = 0;
  1634. !     while (*string != '\0') {
  1635. !       l = len_next_part(string);
  1636. !       if (l == 1) {
  1637. !         switch ( *string ) {
  1638. !         case '(':            /* begin comment on '('        */
  1639. !           ++depth;
  1640. !           break;
  1641. !         case ')':            /* decr nesting level on ')'    */
  1642. !           --depth;
  1643. !           break;
  1644. !         case '\\':            /* treat next char literally    */
  1645. !           if ( *++string == '\0' ) {        /* gracefully handle    */
  1646. !         *bufp++ = '\\';            /* '\' at end of string    */
  1647. !         --string;                /* even tho it's wrong    */
  1648. !           } else if ( depth == 0 ) {
  1649. !         *bufp++ = '\\';
  1650. !         *bufp++ = *string;
  1651. !           }
  1652. !           break;
  1653. !         default:            /* a regular char        */
  1654. !           if ( depth == 0 )
  1655. !         *bufp++ = *string;
  1656. !           break;
  1657. !         }
  1658. !         string++;
  1659. !       } else {
  1660. !         if (depth == 0) {
  1661. !           while (--l >= 0)
  1662. !         *bufp++ = *string++;
  1663. !         } else
  1664. !           string += l;
  1665. !       }
  1666.       }
  1667. !     *bufp = '\0';
  1668. !     return( (char *) buffer);
  1669.   }
  1670.   
  1671. ! /*
  1672. !  * Added by RLH.  This could be combined w/ above if willing to pass
  1673. !  * a TRUE/FALSE for whether we are stripping or getting...
  1674. !  */
  1675. ! char *get_parens(string)
  1676. ! char *string;
  1677.   {
  1678. !     /**
  1679. !         Find and return parenthesized information in a string.  More
  1680. !         specifically, comments as defined in RFC822 are retrieved.
  1681. !         This procedure is non-destructive - a pointer to static data
  1682. !         is returned.
  1683. !     **/
  1684. !     static char  buffer[VERY_LONG_STRING];
  1685. !     register char *bufp;
  1686. !     register int depth, l;
  1687. !     bufp = buffer;
  1688. !     depth = 0;
  1689. !     while (*string != '\0') {
  1690. !       l = len_next_part(string);
  1691. !       if (l == 1) {
  1692. !         switch ( *string ) {
  1693. !         case '(':            /* begin comment on '('        */
  1694. !           ++depth;
  1695. !           break;
  1696. !         case ')':            /* decr nesting level on ')'    */
  1697. !           --depth;
  1698. !           break;
  1699. !         case '\\':            /* treat next char literally    */
  1700. !           if ( *++string == '\0' ) {        /* gracefully handle    */
  1701. !         *bufp++ = '\\';            /* '\' at end of string    */
  1702. !         --string;                /* even tho it's wrong    */
  1703. !           } else if ( depth > 0 ) {
  1704. !         *bufp++ = '\\';
  1705. !         *bufp++ = *string;
  1706. !           }
  1707. !           break;
  1708. !         default:            /* a regular char        */
  1709. !           if ( depth > 0 )
  1710. !         *bufp++ = *string;
  1711. !           break;
  1712. !         }
  1713. !         string++;
  1714. !       } else {
  1715. !         if (depth > 0) {
  1716. !           while (--l >= 0)
  1717. !         *bufp++ = *string++;
  1718. !         } else
  1719. !           string += l;
  1720. !       }
  1721.       }
  1722. !     *bufp = '\0';
  1723. !     return( (char *) buffer);
  1724.   }
  1725. --- 13,89 ----
  1726.    *
  1727.    *******************************************************************************
  1728.    * $Log: striparens.c,v $
  1729. +  * Revision 5.2  1993/06/10  03:09:06  syd
  1730. +  * Greatly simplified "lib/striparens.c" to use new rfc822_toklen() routine.
  1731. +  * This cut more than 50% out of the object size.  Also added _TEST case.
  1732. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  1733. +  *
  1734.    * Revision 5.1  1992/10/03  22:41:36  syd
  1735.    * Initial checkin as of 2.4 Release at PL0
  1736.    *
  1737.    *
  1738.    ******************************************************************************/
  1739.   
  1740. ! /* 
  1741. !  * strip_parens() - Delete all (parenthesized) information from a string.
  1742. !  * get_parens() - Extract all (parenthesized) information from a string.
  1743. !  *
  1744. !  * These routines handle RFC-822 comments.  Nested parens are understood.
  1745. !  * get_parens() does not include the parens in the return result.  Both
  1746. !  * routines are non-destructive.  They return a pointer to static data
  1747. !  * that will be overwritten on the next call to either routine.
  1748. !  */
  1749.   
  1750.   #include "headers.h"
  1751.   
  1752. + static char paren_buffer[VERY_LONG_STRING];
  1753.   
  1754. ! char *strip_parens(src)
  1755. ! register char *src;
  1756.   {
  1757. !     register int len;
  1758. !     register char *dest = paren_buffer;
  1759. !     while (*src != '\0') {
  1760. !         len = rfc822_toklen(src);
  1761. !         if (*src != '(') {    /*)*/
  1762. !             strncpy(dest, src, len);
  1763. !             dest += len;
  1764. !         }
  1765. !         src += len;
  1766.       }
  1767. !     *dest = '\0';
  1768. !     return paren_buffer;
  1769.   }
  1770.   
  1771. ! char *get_parens(src)
  1772. ! register char *src;
  1773.   {
  1774. !     register int len;
  1775. !     register char *dest = paren_buffer;
  1776. !     while (*src != '\0') {
  1777. !         len = rfc822_toklen(src);
  1778. !         if (len > 2 && *src == '(') {    /*)*/
  1779. !             strncpy(dest, src+1, len-2);
  1780. !             dest += (len-2);
  1781. !         }
  1782. !         src += len;
  1783. !     }
  1784. !     *dest = '\0';
  1785. !     return paren_buffer;
  1786. ! }
  1787. ! #ifdef _TEST
  1788. ! main()
  1789. ! {
  1790. !     char buf[1024];
  1791. !     while (fputs("\nstr> ", stdout), gets(buf) != NULL) {
  1792. !         printf("strip_parens() |%s|\n", strip_parens(buf));
  1793. !         printf("get_parens()   |%s|\n", get_parens(buf));
  1794.       }
  1795. !     putchar('\n');
  1796. !     exit(0);
  1797.   }
  1798. + #endif
  1799.  
  1800. Index: lib/strtokq.c
  1801. Prereq: 5.2
  1802. *** ../elm2.4/lib/strtokq.c    Wed Feb  3 11:20:33 1993
  1803. --- lib/strtokq.c    Mon Jul 19 22:05:17 1993
  1804. ***************
  1805. *** 1,8 ****
  1806.   
  1807. ! static char rcsid[] = "@(#)$Id: strtokq.c,v 5.2 1993/02/03 16:20:30 syd Exp $";
  1808.   
  1809.   /*******************************************************************************
  1810. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  1811.    *
  1812.    *            Copyright (c) 1988-1992 USENET Community Trust
  1813.    *            Copyright (c) 1986,1987 Dave Taylor
  1814. --- 1,8 ----
  1815.   
  1816. ! static char rcsid[] = "@(#)$Id: strtokq.c,v 5.3 1993/07/20 02:05:17 syd Exp $";
  1817.   
  1818.   /*******************************************************************************
  1819. !  *  The Elm Mail System  -  $Revision: 5.3 $   $State: Exp $
  1820.    *
  1821.    *            Copyright (c) 1988-1992 USENET Community Trust
  1822.    *            Copyright (c) 1986,1987 Dave Taylor
  1823. ***************
  1824. *** 14,19 ****
  1825. --- 14,35 ----
  1826.    *
  1827.    *******************************************************************************
  1828.    * $Log: strtokq.c,v $
  1829. +  * Revision 5.3  1993/07/20  02:05:17  syd
  1830. +  * A long-standing bug of handling replies to VMS systems.
  1831. +  * Original "From: " -line is of format:
  1832. +  *     From: "NAME \"Real Name\"" <USERNAME@vms-system>
  1833. +  * (PMDF mailer)
  1834. +  *     Anyway,  parse_arpa_who()  strips quotes too cleanly
  1835. +  * resulting data:
  1836. +  *     NAME \"Real Name\
  1837. +  * which, when put into parenthesis, becomes:
  1838. +  *     (NAME \"Real Name\)
  1839. +  * which in its turn lacks closing `)'
  1840. +  * Patch of  lib/parsarpwho.c  fixes that.
  1841. +  * strtokq() started one position too late to search for next double-quote (") char.
  1842. +  * Another one-off (chops off trailing comment character, quote or not..)  in   src/reply.c
  1843. +  * From:    Matti Aarnio <mea@utu.fi>
  1844. +  *
  1845.    * Revision 5.2  1993/02/03  16:20:30  syd
  1846.    * add include file
  1847.    *
  1848. ***************
  1849. *** 54,60 ****
  1850.           register char *sp;
  1851.           char quote = *sourceptr++;
  1852.   
  1853. !         for (sp = sourceptr+1; *sp != '\0' && *sp != quote; sp++)
  1854.             if (*sp == '\\') sp++;    /* skip escaped characters */
  1855.                       /* expand_macros will fix them later */
  1856.   
  1857. --- 70,76 ----
  1858.           register char *sp;
  1859.           char quote = *sourceptr++;
  1860.   
  1861. !         for (sp = sourceptr; *sp != '\0' && *sp != quote; sp++)
  1862.             if (*sp == '\\') sp++;    /* skip escaped characters */
  1863.                       /* expand_macros will fix them later */
  1864.   
  1865.  
  1866. Index: nls/C/C/C/s_aliases.m
  1867. *** ../elm2.4/nls/C/C/C/s_aliases.m    Sat May  8 13:03:49 1993
  1868. --- nls/C/C/C/s_aliases.m    Sat Jun 12 01:26:18 1993
  1869. ***************
  1870. *** 31,37 ****
  1871.   $ #MenuLn3
  1872.   16    l)imit display, m)ail, n)ew alias, r)eturn, t)ag, u)ndelete, or e(x)it
  1873.   $ #Sort
  1874. ! 17    Sorting messages by %s...
  1875.   $ group and person must both be 6 characters long
  1876.   $ #Group
  1877.   18    " Group"
  1878. --- 31,37 ----
  1879.   $ #MenuLn3
  1880.   16    l)imit display, m)ail, n)ew alias, r)eturn, t)ag, u)ndelete, or e(x)it
  1881.   $ #Sort
  1882. ! 17    Sorting aliases by %s...
  1883.   $ group and person must both be 6 characters long
  1884.   $ #Group
  1885.   18    " Group"
  1886.  
  1887. Index: nls/C/C/C/s_answer.m
  1888. *** ../elm2.4/nls/C/C/C/s_answer.m    Tue Jan 19 22:36:05 1993
  1889. --- nls/C/C/C/s_answer.m    Tue Aug 10 14:53:57 1993
  1890. ***************
  1891. *** 38,44 ****
  1892.   $ #EnterMessage
  1893.   18    \n\nEnter message for %s ending with a blank line.\n\n
  1894.   $ #ElmCommand
  1895. ! 19    ((%s -s "While You Were Out" %s ; %s %s) & ) < %s > /dev/null
  1896.   $ #CannotHaveMoreNames
  1897.   20    ** Can't have more than 'FirstName LastName' as address!\n
  1898.   $ #NotFoundForGroup
  1899. --- 38,44 ----
  1900.   $ #EnterMessage
  1901.   18    \n\nEnter message for %s ending with a blank line.\n\n
  1902.   $ #ElmCommand
  1903. ! 19    ( ( %s -s "While You Were Out" %s < %s ; %s %s) & ) > /dev/null
  1904.   $ #CannotHaveMoreNames
  1905.   20    ** Can't have more than 'FirstName LastName' as address!\n
  1906.   $ #NotFoundForGroup
  1907.  
  1908. Index: nls/C/C/C/s_elm.m
  1909. *** ../elm2.4/nls/C/C/C/s_elm.m    Mon May 31 15:34:49 1993
  1910. --- nls/C/C/C/s_elm.m    Tue Aug  3 14:58:06 1993
  1911. ***************
  1912. *** 1000,1010 ****
  1913. --- 1000,1012 ----
  1914.   \t -dn\t\tDebug - set debug level to 'n'\n\r\
  1915.   \t -fx\t\tFolder - read folder 'x' rather than incoming mailbox\n\r\
  1916.   \t -h \t\tHelp - give this list of options\n\r\
  1917. + \t -ix\t\tInclude prepared file 'x' in edit buffer for send\n\r\
  1918.   \t -k \t\tKeypad - enable HP 2622 terminal keyboard\n\r
  1919.   $ #ArgsHelp2
  1920.   536    \t -K \t\tKeypad&softkeys - enable use of softkeys + "-k"\n\r\
  1921.   \t -m \t\tMenu - Turn off menu, using more of the screen\n\r\
  1922.   \t -sx\t\tSubject 'x' - for batch mailing\n\r\
  1923. + \t -t \t\tTiTe - don't use termcap/terminfo ti/te entries.\n\r\
  1924.   \t -V \t\tEnable sendmail voyeur mode.\n\r\
  1925.   \t -v \t\tPrint out ELM version information.\n\r\
  1926.   \t -z \t\tZero - don't enter ELM if no mail is pending\n\r\
  1927. ***************
  1928. *** 1066,1073 ****
  1929.   564    Too many weed headers! Out of memory!  Leaving...\n\r
  1930.   $ #NoMemDefaultWeed
  1931.   565    \nNot enough memory for default weedlist. Leaving.\n
  1932. ! $ #CantExpandEnvVar
  1933. ! 566    \n\rCan't expand environment variable '%s'.\n\r
  1934.   $ #CouldntMakeTempFileName
  1935.   567    Sorry - couldn't make file temp file name.
  1936.   $ #CouldntOpenForWriting
  1937. --- 1068,1075 ----
  1938.   564    Too many weed headers! Out of memory!  Leaving...\n\r
  1939.   $ #NoMemDefaultWeed
  1940.   565    \nNot enough memory for default weedlist. Leaving.\n
  1941. ! $ #CannotInitErrorExpanding
  1942. ! 566    \r\nCannot initialize "%s" - error expanding "%s".\r\n
  1943.   $ #CouldntMakeTempFileName
  1944.   567    Sorry - couldn't make file temp file name.
  1945.   $ #CouldntOpenForWriting
  1946.  
  1947. Index: nls/C/C/C/s_elmalias.m
  1948. *** ../elm2.4/nls/C/C/C/s_elmalias.m    Sun Apr 11 22:10:16 1993
  1949. --- nls/C/C/C/s_elmalias.m    Tue Aug 10 14:54:55 1993
  1950. ***************
  1951. *** 1,6 ****
  1952.   $set 4 #Elmalias
  1953.   $ #Usage
  1954. ! 1    usage: %s [-aenrsuvV] [-f format] [alias ...]\n
  1955.   $ #OutOfMemory
  1956.   2    %s: out of memory [could not allocate %d bytes]\n
  1957.   $ #CannotSpecifyExpand
  1958. --- 1,6 ----
  1959.   $set 4 #Elmalias
  1960.   $ #Usage
  1961. ! 1    usage: %s [-adenrsuvV] [-f format] [alias ...]\n
  1962.   $ #OutOfMemory
  1963.   2    %s: out of memory [could not allocate %d bytes]\n
  1964.   $ #CannotSpecifyExpand
  1965.  
  1966. Index: nls/C/C/C/s_filter.m
  1967. *** ../elm2.4/nls/C/C/C/s_filter.m    Mon Feb  8 13:35:25 1993
  1968. --- nls/C/C/C/s_filter.m    Tue Aug  3 15:07:36 1993
  1969. ***************
  1970. *** 29,35 ****
  1971.   $ #EndMesg
  1972.   14    \n-- End of filtered message --\n
  1973.   $ #CouldntCreateLockFile
  1974. ! 15    filter (%s): Couldn't create lock file %s\n
  1975.   $ #CantOpenMailBox
  1976.   16    filter (%s): Can't open mailbox %s!\n
  1977.   $ #SavedMessage
  1978. --- 29,35 ----
  1979.   $ #EndMesg
  1980.   14    \n-- End of filtered message --\n
  1981.   $ #CouldntCreateLockFile
  1982. ! 15    filter (%s): Couldn't create lock file\n
  1983.   $ #CantOpenMailBox
  1984.   16    filter (%s): Can't open mailbox %s!\n
  1985.   $ #SavedMessage
  1986.  
  1987. Index: nls/gencat/dumpmsg.c
  1988. *** ../elm2.4/nls/gencat/dumpmsg.c    Tue Oct  1 11:42:21 1991
  1989. --- nls/gencat/dumpmsg.c    Sun Aug 22 22:46:29 1993
  1990. ***************
  1991. *** 57,63 ****
  1992.   }
  1993.   
  1994.   void main(
  1995. ! #if defined(__STDC__) || defined(__cplusplus)
  1996.           int argc, char *argv[])
  1997.   #else
  1998.           argc, argv)
  1999. --- 57,63 ----
  2000.   }
  2001.   
  2002.   void main(
  2003. ! #if ANSI_C || defined(__cplusplus)
  2004.           int argc, char *argv[])
  2005.   #else
  2006.           argc, argv)
  2007.  
  2008. Index: nls/gencat/gencat.c
  2009. *** ../elm2.4/nls/gencat/gencat.c    Tue Jun 30 20:56:49 1992
  2010. --- nls/gencat/gencat.c    Sun Aug 22 22:46:29 1993
  2011. ***************
  2012. *** 65,82 ****
  2013.    * will be in C syntax, in bar.H in C++ syntax.
  2014.    */
  2015.   
  2016. ! static void writeIfChanged(
  2017. ! #if defined(__STDC__) || defined(__cplusplus)
  2018. !         char *fname, int lang, int orConsts
  2019.   #endif
  2020. ! );
  2021.   
  2022.   void usage() {
  2023. !     fprintf(stderr, "Use: gencat [-new] [-or] [-lang C|C++|ANSIC] catfile msgfile [-h <header-file>]...\n");
  2024.   }
  2025.   
  2026.   void main(
  2027. ! #if defined(__STDC__) || defined(__cplusplus)
  2028.           int argc, char *argv[])
  2029.   #else
  2030.           argc, argv)
  2031. --- 65,87 ----
  2032.    * will be in C syntax, in bar.H in C++ syntax.
  2033.    */
  2034.   
  2035. ! #if ANSI_C || defined(__cplusplus)
  2036. ! # define P_(x) x
  2037. ! #else
  2038. ! # define P_(x) /**/
  2039.   #endif
  2040. ! static void writeIfChanged P_((char *fname, int lang, int orConsts));
  2041. ! #undef P_
  2042.   
  2043.   void usage() {
  2044. !     fprintf(stderr, "Use: gencat [-new] [-or] [-lang C|C++|ANSIC]\n");
  2045. !     fprintf(stderr, "            catfile msgfile [-h <header-file>]...\n");
  2046.   }
  2047.   
  2048.   void main(
  2049. ! #if ANSI_C || defined(__cplusplus)
  2050.           int argc, char *argv[])
  2051.   #else
  2052.           argc, argv)
  2053. ***************
  2054. *** 164,170 ****
  2055.   }
  2056.   
  2057.   static void writeIfChanged(
  2058. ! #if defined(__STDC__) || defined(__cplusplus)
  2059.           char *fname, int lang, int orConsts)
  2060.   #else
  2061.           fname, lang, orConsts)
  2062. --- 169,175 ----
  2063.   }
  2064.   
  2065.   static void writeIfChanged(
  2066. ! #if ANSI_C || defined(__cplusplus)
  2067.           char *fname, int lang, int orConsts)
  2068.   #else
  2069.           fname, lang, orConsts)
  2070.  
  2071. Index: nls/gencat/gencat.h
  2072. *** ../elm2.4/nls/gencat/gencat.h    Mon Sep 23 15:47:46 1991
  2073. --- nls/gencat/gencat.h    Sun Aug 22 22:46:29 1993
  2074. ***************
  2075. *** 79,125 ****
  2076.   
  2077.   #define MAXTOKEN    1024
  2078.   
  2079. ! extern void MCAddSet(
  2080. ! #if defined(__STDC__) || defined(__cplusplus)
  2081. !         int setId, char *c
  2082.   #endif
  2083. !         );
  2084. ! extern void MCDelSet(
  2085. ! #if defined(__STDC__) || defined(__cplusplus)
  2086. !         int setId
  2087. ! #endif
  2088. !         );
  2089. ! extern void MCAddMsg(
  2090. ! #if defined(__STDC__) || defined(__cplusplus)
  2091. !         int msgId, char *msg, char *c
  2092. ! #endif
  2093. !         );
  2094. ! extern void MCDelMsg(
  2095. ! #if defined(__STDC__) || defined(__cplusplus)
  2096. !         int msgId
  2097. ! #endif
  2098. !         );
  2099. ! extern void MCParse(
  2100. ! #if defined(__STDC__) || defined(__cplusplus)
  2101. !         int fd
  2102. ! #endif
  2103. !         );
  2104. ! extern void MCReadCat(
  2105. ! #if defined(__STDC__) || defined(__cplusplus)
  2106. !         int fd
  2107. ! #endif
  2108. !         );
  2109. ! extern void MCWriteConst(
  2110. ! #if defined(__STDC__) || defined(__cplusplus)
  2111. !         int fd, int type, int orConsts
  2112. ! #endif
  2113. !         );
  2114. ! extern void MCWriteCat(
  2115. ! #if defined(__STDC__) || defined(__cplusplus)
  2116. !         int fd
  2117.   #endif
  2118. !         );
  2119. ! extern long MCGetByteOrder();
  2120.   
  2121.   #ifndef True
  2122.   # define True     ~0
  2123. --- 79,103 ----
  2124.   
  2125.   #define MAXTOKEN    1024
  2126.   
  2127. ! #if !defined(ANSI_C) && (defined(__STDC__) || defined(_AIX))
  2128. ! # define ANSI_C 1
  2129.   #endif
  2130. ! #if ANSI_C || defined(__cplusplus)
  2131. ! # define P_(x) x
  2132. ! #else
  2133. ! # define P_(x) /**/
  2134.   #endif
  2135. ! extern void MCAddSet P_((int setId, char *c));
  2136. ! extern void MCDelSet P_((int setId));
  2137. ! extern void MCAddMsg P_((int msgId, char *msg, char *c));
  2138. ! extern void MCDelMsg P_((int msgId));
  2139. ! extern void MCParse P_((int fd));
  2140. ! extern void MCReadCat P_((int fd));
  2141. ! extern void MCWriteConst P_((int fd, int type, int orConsts));
  2142. ! extern void MCWriteCat P_((int fd));
  2143. ! extern long MCGetByteOrder P_((void));
  2144.   
  2145.   #ifndef True
  2146.   # define True     ~0
  2147.  
  2148. Index: src/a_sort.c
  2149. Prereq: 5.4
  2150. *** ../elm2.4/src/a_sort.c    Sun Apr 11 21:10:15 1993
  2151. --- src/a_sort.c    Sat Jun 12 01:27:55 1993
  2152. ***************
  2153. *** 1,8 ****
  2154.   
  2155. ! static char rcsid[] = "@(#)$Id: a_sort.c,v 5.4 1993/04/12 01:10:15 syd Exp $";
  2156.   
  2157.   /*******************************************************************************
  2158. !  *  The Elm Mail System  -  $Revision: 5.4 $   $State: Exp $
  2159.    *
  2160.    *             Copyright (c) 1988-1992 USENET Community Trust
  2161.    *             Copyright (c) 1986,1987 Dave Taylor
  2162. --- 1,8 ----
  2163.   
  2164. ! static char rcsid[] = "@(#)$Id: a_sort.c,v 5.5 1993/06/12 05:27:44 syd Exp $";
  2165.   
  2166.   /*******************************************************************************
  2167. !  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  2168.    *
  2169.    *             Copyright (c) 1988-1992 USENET Community Trust
  2170.    *             Copyright (c) 1986,1987 Dave Taylor
  2171. ***************
  2172. *** 14,19 ****
  2173. --- 14,23 ----
  2174.    *
  2175.    *******************************************************************************
  2176.    * $Log: a_sort.c,v $
  2177. +  * Revision 5.5  1993/06/12  05:27:44  syd
  2178. +  * Fix calling sequence error
  2179. +  * From: Syd
  2180. +  *
  2181.    * Revision 5.4  1993/04/12  01:10:15  syd
  2182.    * fix @aliasname sort problem
  2183.    * From: "Robert L. Howard" <robert.howard@matd.gatech.edu>
  2184. ***************
  2185. *** 75,81 ****
  2186.   
  2187.       if ((entries > 30) && visible && are_in_aliases) {
  2188.           error1(catgets(elm_msg_cat, AliasesSet, AliasesSort,
  2189. !             "Sorting messages by %s..."), alias_sort_name(FULL));
  2190.       }
  2191.       
  2192.       if (entries > 1)
  2193. --- 79,85 ----
  2194.   
  2195.       if ((entries > 30) && visible && are_in_aliases) {
  2196.           error1(catgets(elm_msg_cat, AliasesSet, AliasesSort,
  2197. !             "Sorting aliases by %s..."), alias_sort_name(FULL));
  2198.       }
  2199.       
  2200.       if (entries > 1)
  2201.  
  2202. Index: src/addr_util.c
  2203. Prereq: 5.10
  2204. *** ../elm2.4/src/addr_util.c    Mon May 31 15:32:21 1993
  2205. --- src/addr_util.c    Tue Aug  3 15:28:59 1993
  2206. ***************
  2207. *** 1,8 ****
  2208.   
  2209. ! static char rcsid[] = "@(#)$Id: addr_util.c,v 5.10 1993/05/31 19:32:20 syd Exp $";
  2210.   
  2211.   /*******************************************************************************
  2212. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  2213.    *
  2214.    *             Copyright (c) 1988-1992 USENET Community Trust
  2215.    *             Copyright (c) 1986,1987 Dave Taylor
  2216. --- 1,8 ----
  2217.   
  2218. ! static char rcsid[] = "@(#)$Id: addr_util.c,v 5.11 1993/08/03 19:28:39 syd Exp $";
  2219.   
  2220.   /*******************************************************************************
  2221. !  *  The Elm Mail System  -  $Revision: 5.11 $   $State: Exp $
  2222.    *
  2223.    *             Copyright (c) 1988-1992 USENET Community Trust
  2224.    *             Copyright (c) 1986,1987 Dave Taylor
  2225. ***************
  2226. *** 14,19 ****
  2227. --- 14,31 ----
  2228.    *
  2229.    *******************************************************************************
  2230.    * $Log: addr_util.c,v $
  2231. +  * Revision 5.11  1993/08/03  19:28:39  syd
  2232. +  * Elm tries to replace the system toupper() and tolower() on current
  2233. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2234. +  * collide during linking with routines in isctype.o.  This patch adds
  2235. +  * a Configure test to determine whether replacements are really needed
  2236. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2237. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2238. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2239. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2240. +  * were dropped.
  2241. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2242. +  *
  2243.    * Revision 5.10  1993/05/31  19:32:20  syd
  2244.    * With this patch build_address() should treat local mailing
  2245.    * lists and other aliases known by the transport agent as valid
  2246. ***************
  2247. *** 80,92 ****
  2248.   #include "headers.h"
  2249.   #include "s_elm.h"
  2250.   
  2251. - #include <ctype.h>
  2252. - #ifdef BSD 
  2253. - #undef tolower
  2254. - #undef toupper
  2255. - #endif
  2256.   
  2257.   translate_return(addr, ret_addr)
  2258.   char *addr, *ret_addr;
  2259. --- 92,97 ----
  2260.  
  2261. Index: src/alias.c
  2262. Prereq: 5.34
  2263. *** ../elm2.4/src/alias.c    Thu May 13 23:57:37 1993
  2264. --- src/alias.c    Tue Aug  3 15:29:00 1993
  2265. ***************
  2266. *** 1,8 ****
  2267.   
  2268. ! static char rcsid[] = "@(#)$Id: alias.c,v 5.34 1993/05/14 03:57:36 syd Exp $";
  2269.   
  2270.   /*******************************************************************************
  2271. !  *  The Elm Mail System  -  $Revision: 5.34 $   $State: Exp $
  2272.    *
  2273.    *             Copyright (c) 1988-1992 USENET Community Trust
  2274.    *             Copyright (c) 1986,1987 Dave Taylor
  2275. --- 1,8 ----
  2276.   
  2277. ! static char rcsid[] = "@(#)$Id: alias.c,v 5.37 1993/08/03 19:28:39 syd Exp $";
  2278.   
  2279.   /*******************************************************************************
  2280. !  *  The Elm Mail System  -  $Revision: 5.37 $   $State: Exp $
  2281.    *
  2282.    *             Copyright (c) 1988-1992 USENET Community Trust
  2283.    *             Copyright (c) 1986,1987 Dave Taylor
  2284. ***************
  2285. *** 14,19 ****
  2286. --- 14,42 ----
  2287.    *
  2288.    *******************************************************************************
  2289.    * $Log: alias.c,v $
  2290. +  * Revision 5.37  1993/08/03  19:28:39  syd
  2291. +  * Elm tries to replace the system toupper() and tolower() on current
  2292. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2293. +  * collide during linking with routines in isctype.o.  This patch adds
  2294. +  * a Configure test to determine whether replacements are really needed
  2295. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2296. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2297. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2298. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2299. +  * were dropped.
  2300. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2301. +  *
  2302. +  * Revision 5.36  1993/06/12  05:27:44  syd
  2303. +  * Fix calling sequence error
  2304. +  * From: Syd
  2305. +  *
  2306. +  * Revision 5.35  1993/06/10  02:58:26  syd
  2307. +  * Correct problem in fetch_alias() with alias record fixup that caused
  2308. +  * core dump on machines with pointers larger than int.  This problem
  2309. +  * was reported on comp.mail.elm by Richard Eckman and Jim Brown.  Simplify
  2310. +  * get_one_alias() by having it use fetch_alias().
  2311. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2312. +  *
  2313.    * Revision 5.34  1993/05/14  03:57:36  syd
  2314.    * A couple of calls to want_to() had typos. Here is the patch.
  2315.    * From: Jukka Ukkonen <ukkonen@csc.fi>
  2316. ***************
  2317. *** 230,244 ****
  2318.   #include "headers.h"
  2319.   #include "s_elm.h"
  2320.   #include <errno.h>
  2321. - #include <ctype.h>
  2322.   #include <sys/stat.h>
  2323.   #include "s_aliases.h"
  2324.   #include "ndbz.h"
  2325.   
  2326. - #ifdef BSD
  2327. - #undef        tolower
  2328. - #endif
  2329.   #define    ECHOIT    1     /* echo on for prompting */
  2330.   
  2331.   /*
  2332. --- 253,262 ----
  2333. ***************
  2334. *** 984,990 ****
  2335.   
  2336.       main_state();        /* Save globals for return to main menu */
  2337.   
  2338. !     open_alias_files();    /* First, read the alias files. RLH */
  2339.   
  2340.       alias_screen(newaliases);
  2341.       define_softkeys(ALIAS);
  2342. --- 1002,1008 ----
  2343.   
  2344.       main_state();        /* Save globals for return to main menu */
  2345.   
  2346. !     open_alias_files(FALSE);    /* First, read the alias files. RLH */
  2347.   
  2348.       alias_screen(newaliases);
  2349.       define_softkeys(ALIAS);
  2350. ***************
  2351. *** 1305,1311 ****
  2352.             "Processed %d aliases.  Re-reading the database..."), na);
  2353.           if (sleepmsg > 0)
  2354.           sleep(sleepmsg);
  2355. !         open_alias_files();
  2356.           set_error(catgets(elm_msg_cat, AliasesSet, AliasesUpdatedOK,
  2357.             "Aliases updated successfully."));
  2358.       }
  2359. --- 1323,1329 ----
  2360.             "Processed %d aliases.  Re-reading the database..."), na);
  2361.           if (sleepmsg > 0)
  2362.           sleep(sleepmsg);
  2363. !         open_alias_files(TRUE);
  2364.           set_error(catgets(elm_msg_cat, AliasesSet, AliasesUpdatedOK,
  2365.             "Aliases updated successfully."));
  2366.       }
  2367. ***************
  2368. *** 1537,1610 ****
  2369.    *    Get an alias (name, address, etc.) from the data file
  2370.    */
  2371.   
  2372. !     long new_max;
  2373. !     register struct alias_rec    **new_aliases, *a;
  2374. !     struct alias_rec    ar;
  2375. !     FILE *data_file = db->dbz_basef;
  2376.   
  2377. !     if(read_one_alias(db, &ar) == 0) {
  2378. !         return(0);
  2379. !     }
  2380.   
  2381.       if (current >= max_aliases) {
  2382.           new_max = max_aliases + KLICK;
  2383. !         if (max_aliases == 0)
  2384. !         new_aliases = (struct alias_rec **)
  2385. !             malloc(new_max * sizeof(struct alias_rec *));
  2386. !         else
  2387. !         new_aliases = (struct alias_rec **)
  2388. !             realloc((char *) aliases,
  2389. !             new_max * sizeof(struct alias_rec *));
  2390. !         if (new_aliases == NULL) {
  2391. !         error1(catgets(elm_msg_cat, AliasesSet, AliasesErrorMemory,
  2392. !       "\n\r\n\rCouldn't allocate enough memory! Alias #%d.\n\r\n\r"),
  2393. !             current);
  2394. !         return(0);
  2395.           }
  2396. -         aliases = new_aliases;
  2397.           while (max_aliases < new_max)
  2398.           aliases[max_aliases++] = NULL;
  2399.       }
  2400.   
  2401. !     if (aliases[current] != NULL) {
  2402. !         free((char *) aliases[current]);
  2403. !         aliases[current] = NULL;
  2404. !     }
  2405. !     if ((a = (struct alias_rec *)
  2406. !         malloc(sizeof(ar) + ar.length)) == NULL) {
  2407. !         error1(catgets(elm_msg_cat, AliasesSet, AliasesErrorMemory,
  2408. !       "\n\r\n\rCouldn't allocate enough memory! Alias #%d.\n\r\n\r"),
  2409. !             current);
  2410. !         return(0);
  2411. !         }
  2412.       aliases[current] = a;
  2413. !     fread((char *) (a + 1), ar.length, 1, data_file);
  2414. !     *a = ar;
  2415. ! #ifdef CRAY
  2416. !     a->alias = (int) a->alias + (char *) (a + 1);
  2417. !     a->last_name = (int) a->last_name + (char *) (a + 1);
  2418. !     a->name = (int) a->name + (char *) (a + 1);
  2419. !     a->comment = (int) a->comment + (char *) (a + 1);
  2420. !     a->address = (int) a->address + (char *) (a + 1);
  2421. ! #else
  2422. !     new_max = (long) (a + 1);
  2423. !     a->alias += new_max;
  2424. !     a->last_name += new_max;
  2425. !     a->name += new_max;
  2426. !     a->comment += new_max;
  2427. !     a->address += new_max;
  2428. ! #endif
  2429. !     a->length = current;   
  2430. !   
  2431. !     return(1);
  2432.   }
  2433.   
  2434.   main_state()
  2435.   {
  2436.   /*    Save the globals that are shared for both menus
  2437. --- 1555,1587 ----
  2438.    *    Get an alias (name, address, etc.) from the data file
  2439.    */
  2440.   
  2441. !     int new_max;
  2442. !     register struct alias_rec *a;
  2443. !     extern struct alias_rec *fetch_alias();
  2444.   
  2445. !     if ((a = fetch_alias(db, (char *)NULL)) == NULL)
  2446. !         return 0;
  2447.   
  2448.       if (current >= max_aliases) {
  2449.           new_max = max_aliases + KLICK;
  2450. !         if (max_aliases == 0) {
  2451. !         aliases = (struct alias_rec **)
  2452. !             safe_malloc(new_max * sizeof(struct alias_rec *));
  2453. !         } else {
  2454. !         aliases = (struct alias_rec **) safe_realloc((malloc_t)aliases,
  2455. !             new_max * sizeof(struct alias_rec *));
  2456.           }
  2457.           while (max_aliases < new_max)
  2458.           aliases[max_aliases++] = NULL;
  2459.       }
  2460.   
  2461. !     if (aliases[current] != NULL)
  2462. !         free((malloc_t)aliases[current]);
  2463.       aliases[current] = a;
  2464. !     return 1;
  2465.   }
  2466.   
  2467.   main_state()
  2468.   {
  2469.   /*    Save the globals that are shared for both menus
  2470.  
  2471. Index: src/aliaslib.c
  2472. Prereq: 5.9
  2473. *** ../elm2.4/src/aliaslib.c    Mon May 31 15:39:44 1993
  2474. --- src/aliaslib.c    Tue Aug  3 15:29:01 1993
  2475. ***************
  2476. *** 1,8 ****
  2477.   
  2478. ! static char rcsid[] = "@(#)$Id: aliaslib.c,v 5.9 1993/05/31 19:39:43 syd Exp $";
  2479.   
  2480.   /*******************************************************************************
  2481. !  *  The Elm Mail System  -  $Revision: 5.9 $   $State: Exp $
  2482.    *
  2483.    *             Copyright (c) 1988-1992 USENET Community Trust
  2484.    *             Copyright (c) 1986,1987 Dave Taylor
  2485. --- 1,8 ----
  2486.   
  2487. ! static char rcsid[] = "@(#)$Id: aliaslib.c,v 5.10 1993/08/03 19:28:39 syd Exp $";
  2488.   
  2489.   /*******************************************************************************
  2490. !  *  The Elm Mail System  -  $Revision: 5.10 $   $State: Exp $
  2491.    *
  2492.    *             Copyright (c) 1988-1992 USENET Community Trust
  2493.    *             Copyright (c) 1986,1987 Dave Taylor
  2494. ***************
  2495. *** 14,19 ****
  2496. --- 14,31 ----
  2497.    *
  2498.    *******************************************************************************
  2499.    * $Log: aliaslib.c,v $
  2500. +  * Revision 5.10  1993/08/03  19:28:39  syd
  2501. +  * Elm tries to replace the system toupper() and tolower() on current
  2502. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2503. +  * collide during linking with routines in isctype.o.  This patch adds
  2504. +  * a Configure test to determine whether replacements are really needed
  2505. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2506. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2507. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2508. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2509. +  * were dropped.
  2510. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2511. +  *
  2512.    * Revision 5.9  1993/05/31  19:39:43  syd
  2513.    * Elm either failed to expand a group alias or crashed in strlen
  2514.    * (called from do_expand_group()).
  2515. ***************
  2516. *** 70,76 ****
  2517.   
  2518.   #include "headers.h"
  2519.   #include "s_elm.h"
  2520. - #include <ctype.h>
  2521.   
  2522.   char *get_alias_address(), *qstrpbrk();
  2523.   extern int current_mail_message;
  2524. --- 82,87 ----
  2525.  
  2526. Index: src/builtin.c
  2527. Prereq: 5.1
  2528. *** ../elm2.4/src/builtin.c    Sat Oct  3 18:58:47 1992
  2529. --- src/builtin.c    Tue Aug  3 15:29:01 1993
  2530. ***************
  2531. *** 1,8 ****
  2532.   
  2533. ! static char rcsid[] = "@(#)$Id: builtin.c,v 5.1 1992/10/03 22:58:40 syd Exp $";
  2534.   
  2535.   /*******************************************************************************
  2536. !  *  The Elm Mail System  -  $Revision: 5.1 $   $State: Exp $
  2537.    *
  2538.    *             Copyright (c) 1988-1992 USENET Community Trust
  2539.    *             Copyright (c) 1986,1987 Dave Taylor
  2540. --- 1,8 ----
  2541.   
  2542. ! static char rcsid[] = "@(#)$Id: builtin.c,v 5.2 1993/08/03 19:28:39 syd Exp $";
  2543.   
  2544.   /*******************************************************************************
  2545. !  *  The Elm Mail System  -  $Revision: 5.2 $   $State: Exp $
  2546.    *
  2547.    *             Copyright (c) 1988-1992 USENET Community Trust
  2548.    *             Copyright (c) 1986,1987 Dave Taylor
  2549. ***************
  2550. *** 14,19 ****
  2551. --- 14,31 ----
  2552.    *
  2553.    *******************************************************************************
  2554.    * $Log: builtin.c,v $
  2555. +  * Revision 5.2  1993/08/03  19:28:39  syd
  2556. +  * Elm tries to replace the system toupper() and tolower() on current
  2557. +  * BSD systems, which is unnecessary.  Even worse, the replacements
  2558. +  * collide during linking with routines in isctype.o.  This patch adds
  2559. +  * a Configure test to determine whether replacements are really needed
  2560. +  * (BROKE_CTYPE definition).  The <ctype.h> header file is now included
  2561. +  * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
  2562. +  * there.  Inclusion of <ctype.h> was removed from *all* the individual
  2563. +  * files, and the toupper() and tolower() routines in lib/opt_utils.c
  2564. +  * were dropped.
  2565. +  * From: chip@chinacat.unicom.com (Chip Rosenthal)
  2566. +  *
  2567.    * Revision 5.1  1992/10/03  22:58:40  syd
  2568.    * Initial checkin as of 2.4 Release at PL0
  2569.    *
  2570. ***************
  2571. *** 32,38 ****
  2572.   
  2573.   #include "headers.h"
  2574.   #include "s_elm.h"
  2575. - #include <ctype.h>
  2576.   
  2577.   #define  BEEP        007        /* ASCII Bell character */
  2578.   
  2579. --- 44,49 ----
  2580.  
  2581.